Enabling Session in SharePoint 2010

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 " is the error message you receive when you try to use the Session object in the SharePoint Application Page. By default, the sessions are disabled in the SharePoint environment.
 
To activate the session in the SharePoint:
  1. Make sure that the ASP.Net State Service is up and running
  2. Add the following code in the web.config of all the servers. Make sure that the enableSessionState is true.
<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" asyncTimeout="7">
 
3. Make sure that the below entires the Module section.

<remove name="Session" />
<
add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />