Reputation: 14774
Whenever I use session variables in webparts in sharepoint the page doesn't load and i get an error. I was adviced to enable them because they may be disabled. Any clue?
Upvotes: 0
Views: 16369
Reputation: 14774
You have to modify two lines, the first one mentioned by kusek and another one:
Uncomment the following line:
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
Modify the following line:
<pages enableSessionState="true" ….. />
Upvotes: 0
Reputation: 11
THEN, you must go into your web application and add the same session state module to the IIS7 managed pipeline.
1.Open IIS 7 manager, and find your web application. 2.Double click "Modules" in the IIS section. 3.Click "Add Managed Module..." on the right hand pane. 4.In the Add Managed Module dialog, enter "SessionState" or something like that for the name, and choose the following item from the dropdown: System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
After that, session state should be enabled for your web app/web service!
Upvotes: 1
Reputation: 4801
You may also need to add/uncomment the Sessionstate module in your web.config file, under <system.web><httpModules>
:
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
Upvotes: 0
Reputation: 5384
By Default the Session State is Disabled in SharePoint. If you look at the Web.Config the you will see that as below.
<pages enableSessionState="false"
You can enable it there. Else you can Enable this at the Page Level.
Upvotes: 2