SharePoint 2010 and “Session state can only be used when enableSessionState is set to true …”

If SharePoint 2010 shows the error message below simply adjust the web.config in 2 places.

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.

Enable session state for all pages:

<pages enableSessionState="true" ... > 
 ...
</pages> 

Add the SessionStateModule–yes, while the error message talks about httpModules it’s actually the modules element:

<modules runAllManagedModulesForAllRequests="true">
 ...
 <remove name="Session" />
 <add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
 ...
</modules>

Note to self: and now don’t forget it again!

Advertisements
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

2 Responses to SharePoint 2010 and “Session state can only be used when enableSessionState is set to true …”

  1. Maya says:

    Thanks a lot, it really helped me!!
    i spent a lot of time trying to resolve this problem!!

  2. Talal says:

    thanks a lot…it really saved my time 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s