Getting sessionstate error in IIS7

I get the following error on a webpage. We recently moved the site from IIS6 to IIS7, his first introduction to IIS7. We have not closed another domain yet, and the site is working fine (so we can compare it until the migration is complete.)

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 \ section of the application configuration.

+4
source share
2 answers

The solution is very curious. Although IIS7 in the error description says that add SessionStateModule to the system.web section, it should be added to the system.webServer section.

<system.webServer> <modules> <remove name="Session" /> <add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </modules> </system.webServer> 
+2
source
 <system.web> <httpModules> <remove name="Session" /> <add name="Session" type="System.Web.SessionState.SessionStateModule" /> </httpModules> </system.web> 

It works fine on the code !!!

If you use in, then this code has no effect.

+1
source

All Articles