System.Web.SessionState.SessionStateUtility Class

Provides helper methods used by session-state modules and session-state store providers to manage session information for an ASP.NET application. This class cannot be inherited.

See Also: SessionStateUtility Members


public static class SessionStateUtility


The System.Web.SessionState.SessionStateUtility class provides static helper methods that are used by a session-state module or a session-state store provider. Application developers will not need to call these methods from their code.

The following table describes the ways the session-state module and session-state store provider use the methods.

SessionStateUtility.GetHttpSessionStateFromContext(System.Web.HttpContext) method

Can be used by custom session-state modules to either retrieve session information for an existing session or create session information for a new session.

SessionStateUtility.AddHttpSessionStateToContext(System.Web.HttpContext, IHttpSessionState) method

Called by the session-state module to add the session data to the current System.Web.HttpContext and make it available to application code through the System.Web.HttpContext.Session property.

SessionStateUtility.RemoveHttpSessionStateFromContext(System.Web.HttpContext) method

Called by the session-state module during the System.Web.HttpApplication.ReleaseRequestState or System.Web.HttpApplication.EndRequest events at the end of a request, to clear session data from the current System.Web.HttpContext.

SessionStateUtility.GetSessionStaticObjects(System.Web.HttpContext) method

Called by the session-state module to get a reference to the HttpSessionState.StaticObjects collection based on objects defined in the Global.asax file. The System.Web.HttpStaticObjectsCollection collection returned is included with the session data added to the current System.Web.HttpContext.

Session data is passed to and retrieved from the current System.Web.HttpContext as an System.Web.SessionState.HttpSessionStateContainer object or any valid implementation of the System.Web.SessionState.IHttpSessionState interface.

For information about implementing a session-state store provider, see Implementing a Session State Store Provider.


Namespace: System.Web.SessionState
Assembly: System.Web (in System.Web.dll)
Assembly Versions: