Shuja
Shuja

Reputation:

Getting sessionstate error in IIS7

I'm getting the following error on a webpage. We recently migrate a website from IIS6 to IIS7, its my first exposure to IIS7. We have'nt closed the other domain yet, and the site is running all fine (so we can compare until migration is fully completed.)

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

Upvotes: 4

Views: 2537

Answers (2)

Himalaya Garg
Himalaya Garg

Reputation: 1609

<system.web>
  <httpModules>
     <remove name="Session" />
       <add name="Session" type="System.Web.SessionState.SessionStateModule" />
  </httpModules>
</system.web>

Above code works fine!!!

If using in , then this code does not have any effect.

Upvotes: 1

flashnik
flashnik

Reputation: 1932

The solution is very curious. Though IIS7 in error description says to add SessionStateModule to system.web section, it should be added to 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>

Upvotes: 2

Related Questions