Using the steps provided here, we can enable session state for the web
application and we can use the session variables wherever are required in the
application.
Mission
Enabling
Session State in SharePoint 2010.
Game Plan
2. Steps for Enabling Session State
in SharePoint 2010.
So let’s begin…
The concept
If you are trying to use session state in SharePoint 2010
to store data for use in web parts, application pages, etc. you may encounter
the error below if session state is not properly configured and enabled for the
web application.
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 \\<...
To resolve the error and to enable session state for SharePoint we need to follow the steps given below.
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 \\<...
To resolve the error and to enable session state for SharePoint we need to follow the steps given below.
Steps for Enabling Session State in SharePoint 2010
1.
To enable Session State first add the SessionStateModule to the
web.config file as shown below:
2. Ensure
that enableSessionState is set to TRUE as follows:
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
3.
Then, you must go into your web application
and add the same session state module to the IIS7 managed pipeline.
i.
Open IIS 7 manager, and find your
web application.
- Double click "Modules" in the IIS section.
- Click "Add Managed Module..." on the right hand pane.
- 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.
That’s it! Session State should then work in
your SharePoint application.
Where it can be used:
Any application where we want to use session state.
Is this the Work Around or Best Solution?
This is Best Solution for enabling session state for your
application.
No comments:
Post a Comment