See Also: IHttpSessionState Members
A session-state container provides access to the session-state values and related information for the current session. Session information included in a session-state container is exposed to application code through the System.Web.SessionState.HttpSessionState class using the System.Web.HttpContext.Session property. The System.Web.SessionState.HttpSessionState class is a wrapper class for a session-state container.
The ASP.NET implementation of a session-state container is the System.Web.SessionState.HttpSessionStateContainer class. At the beginning of a request, during the System.Web.HttpApplication.AcquireRequestState event, the System.Web.SessionState.SessionStateModule creates and populates an System.Web.SessionState.HttpSessionStateContainer object and assigns it to the current System.Web.HttpContext. At the end of a request, during the System.Web.HttpApplication.ReleaseRequestState event, the System.Web.SessionState.SessionStateModule retrieves the System.Web.SessionState.HttpSessionStateContainer object from the current System.Web.HttpContext and performs any required session work, such as writing the session values to the session store, or abandoning the session. If the request is abruptly terminated, such as through a redirect, the System.Web.SessionState.SessionStateModule performs the same cleanup by calling the SessionStateStoreProviderBase.EndRequest(System.Web.HttpContext) method.
To create a custom session-state container, create a class that implements the System.Web.SessionState.IHttpSessionState interface. If you are creating your own custom session-state container, you must also replace the System.Web.SessionState.SessionStateModule with your own custom module. Your custom module will create an instance of your custom session-state container and add it to the current System.Web.HttpContext using the SessionStateUtility.AddHttpSessionStateToContext(System.Web.HttpContext, IHttpSessionState) method. An example of a custom session-state module is included in the System.Web.SessionState.SessionStateUtility class overview.