Wednesday, July 6, 2011

Enable Session state for SharePoint 2010

By default, the Session state is disable in SharePoint 2010. If we use Session in application page, following exception will occur:


To enable the Session status in SharePoint, we need to take following two steps:

1. Change the EnableSessionState to ture in the page declaration like below:
<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="True" ...

2. Modify the web.config file (C:\inetpub\wwwroot\wss\VirtualDirectories\80 by default), add this line:
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
After
<remove name="Session" />




No comments:

Post a Comment