SharePoint 2010 uses two services related to session state that have similar names but are separate and have different purposes.
To enable ASP.NET session state:
Enable-SPSessionStateService –DefaultProvision
<pages enableSessionState="true"
Guidelines for using SharePoint Server ASP.NET Session State:
Additional information about enabling session state:
Syntax 1
Syntax 2
Enable-SPSessionStateService -DefaultProvision
Enable-SPSessionStateService -DatabaseName <String> [-DatabaseServer <String>] [-DatabaseCredentials <PSCredential>]
Additional parameters are not discussed here; use Get-Help Enable-SPSessionStateService –full for more information.
The Enable-SPSessionStateService cmdlet creates a session state database, installs the ASP.NET session state schema, and updates the Web.config files on the farm to turn on the session state service.
If the DefaultProvision form of the command is used, all default settings are used. These are:
If the DatabaseName form of the command is used, then these parameters may be set explicitly. If some of the parameters are not included, they default as above. To set specific credentials for accessing the session state database, note that this allows you to specify a SQL Authentication credential only, not a Windows credential. Then, use the Get-Credential command to create a PSCredential object from a username and password, then use that object as the argument of the DatabaseCredentials parameter.
After this service is enabled, “SharePoint Server ASP.NET Session State Service” will appear on the Service Applications management page.