views:

2333

answers:

3

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?

+1  A: 

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.

Kusek
Thanks man, but which Web.Config file exactly should I modify that in?
Ahmad Farid
Web.Config file of the SharePoint Site that you are Using. Be selective about enabling the Session in the whole application. Because it will be a extra call for the Pages that dont need the Session. So I would advice that you enable only on the Page where you want the Session.
Kusek
But still which pages? I mean how can I know those pages on the hard drive? Where are they present and what is its path?
Ahmad Farid
I am using SmartPart which addes a usercontrol into a webpart in sharepoint.
Ahmad Farid
I think i found somethign and modified to this but it still makes the same error: <pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">
Ahmad Farid
In your Server follow Start->Run->Type InetMgr->Press Enter->You will get Internet Information Server-> Expand the Tree->Find Web Sites->Find your Web Site . Right Click ->Properties -> Select Home Tab->You see a Local Path Navigate to that Path in the Computer and change that Web Config File
Kusek
i changed it to "true" but its still not working!
Ahmad Farid
A: 

You have to modify two lines, the first one mentioned by kusek and another one:

Uncomment the following line:

Modify the following line:

Ahmad Farid
A: 

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"/>
Blakomen