In this post we will discuss how to resolve error "Session state can only be used when enableSessionState is set to true" which comes in SharePoint 2010.
Also you can check out my previous posts on:
The full error message which comes as: 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.
- We have to enable session state for the pages by adding enableSessionState="true" in the page directives.
- Then we need to modify in the web.config file like below:
Go to the <modules runAllManagedModulesForAllRequests="true">
Remove <remove name="Session" />
And add the below line:
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
Now Save this and it should work fine.
Run the below PowerShell command: