Session State Management in SharePoint
Session state refers to user-specific information that is cached on a Web front-end server. Session state can either be persisted to a database between user requests or kept in memory. Session state can also be kept in a session state server, which is hosted in an external process. By default, SharePoint uses a SQL Server store for session state. This topic discusses aspects of session state that are specific to SharePoint. For a general discussion of how to manage session state, see the references at the end of this topic.
SharePoint uses ASP.NET to manage session state. Because ASP.NET supports Web farms, a SharePoint application does not need additional configuration to handle session state when using multiple Web front-end servers in a farm environment. The ASP.NET session state infrastructure includes session state providers that support persisting session state information to different stores. SharePoint uses the SqlSessionStateStore provider. For more information about ASP.NET session state providers, see Session State Providers on MSDN.
The SqlSessionStateStore provider supports custom partition resolvers that implement the IPartitionResolver interface. A partition resolver redirects the SQLSessionStateStore provider to a particular database based on the session ID. SharePoint implements a partition resolver that redirects SharePoint sessions to SharePoint database tables. SharePoint creates a session state database when the primary shared services provider (SSP) is installed. For information about configuring the primary SSP, see Configure the primary Shared Services Provider on TechNet. For more information about SharePoint sessions, see Manage session state on TechNet.
Microsoft Office Forms Server and Microsoft Office Project Server rely on ASP.NET session state. Excel Services relies on session state but tracks session information directly within the Excel Services SSP instead of relying on the ASP.NET session infrastructure.
SharePoint does not automatically remove old session state records from the session state database tables. Performance will degrade if you do not regularly purge expired sessions. For information about how to do this, see SharePoint Session State; The Guest That Just Won't Leave, a blog post by Todd Carter.
Because SharePoint uses ASP.NET session state, the following related MSDN guidance is directly applicable to SharePoint:
- ASP.NET Session State Overview
- Chapter 3 – Design Guidelines for Application Performance
- Chapter 4 – Architecture and Design Review of a .NET Application for Performance and Scalability
- Chapter 6 – Improving ASP.NET Performance