I DO NOT use MVC, URL rewriting, HTTP custom modules, etc. A basic call to the Session property disables either the web page that inherits from System.Web.UI.Page, or through System.Web.HttpContext.Current. Session, I get the following error:
Session state can only be used when enableSessionState is set to true, either in the configuration file or in the Page directive. Also make sure that the System.Web.SessionStateModule or user session state module is included in the <configuration>\<system.web>\<httpModules> in the application configuration.
After some research, I implemented Web.config as follows, but the error still occurs. I am debugging a web application from Visual Studio 2010 using the embedded web server.
<configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <sessionState mode="InProc" timeout="60" cookieless="false" /> <pages enableSessionState="true" /> <httpModules> <remove name="Session" /> <add name="Session" type="System.Web.SessionState.SessionStateModule" /> </httpModules> </system.web> </configuration>
source share