Session state can only be used when enableSessionState.....................

1 Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModules> section in the application configuration.

在网站的Handler.ashx中操作Session会报enableSessionState异常,在webconfig中配置貌似也不行,其实这里只需要

 1 public class Handler : IHttpHandler, IRequiresSessionState  

实现一下这个接口就行了。


原文地址:https://www.cnblogs.com/nimeide/p/4360440.html