This documentation is archived and is not being maintained.

HttpSessionStateContainer Class

Contains session-state values as well as session-level settings for the current request.


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

public class HttpSessionStateContainer : IHttpSessionState

The HttpSessionStateContainer type exposes the following members.

Public methodHttpSessionStateContainerCreates a new HttpSessionStateContainer object and initializes it with the specified settings and values.

Public propertyCodePageGets or sets the character-set identifier for the current session.
Public propertyCookieModeGets a value that indicates whether the application is configured for cookieless sessions.
Public propertyCountGets the number of items in the session-state collection.
Public propertyIsAbandonedGets a value indicating whether the current session has been abandoned.
Public propertyIsCookielessGets a value indicating whether the session ID is embedded in the URL or stored in an HTTP cookie.
Public propertyIsNewSessionGets a value indicating whether the session was created with the current request.
Public propertyIsReadOnlyGets a value indicating whether the session is read-only.
Public propertyIsSynchronizedGets a value indicating whether access to the collection of session-state values is synchronized (thread safe).
Public propertyItem[Int32]Gets or sets a session value by numerical index.
Public propertyItem[String]Gets or sets a session value by name.
Public propertyKeysGets a collection of the keys for all values stored in the session-state collection.
Public propertyLCIDGets or sets the locale identifier (LCID) of the current session.
Public propertyModeGets the current session-state mode.
Public propertySessionIDGets the unique identifier for the session.
Public propertyStaticObjectsGets a collection of objects declared by <object Runat="Server" Scope="Session"/> tags within the ASP.NET application file Global.asax.
Public propertySyncRootGets an object that can be used to synchronize access to the collection of session-state values.
Public propertyTimeoutGets and sets the amount of time, in minutes, allowed between requests before the session-state provider terminates the session.

Public methodAbandonMarks the current session as abandoned.
Public methodAddAdds a new item to the session-state collection.
Public methodClearRemoves all values and keys from the session-state collection.
Public methodCopyToCopies the collection of session-state values to a one-dimensional array, starting at the specified index in the array.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnumeratorReturns an enumerator that can be used to read all the session-state variable names in the current session.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveDeletes an item from the session-state collection.
Public methodRemoveAllClears all session-state values.
Public methodRemoveAtDeletes an item at a specified index from the session-state collection.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

ASP.NET provides session-state management to enable you to store information associated with a unique browser session across multiple requests. You can store a collection of values referenced by a key name or by numerical index. Access to session values and functionality is available using the HttpSessionState class, which is accessible through the Session property of the current HttpContext or the Session property of the Page. The HttpSessionState class accesses session-state values and session-level settings by referencing a session-state container, which is an implementation of the IHttpSessionState interface that has been populated with session-state data and added to the HttpContext of the current request by the session-state module for the HttpApplication.

The HttpSessionState class calls the HttpSessionStateContainer class, which manages session settings and values in memory.

The HttpSessionStateContainer class is the ASP.NET implementation of the IHttpSessionState interface. The HttpSessionStateContainer class is not intended to be called from application code. If you replace the SessionStateModule with a custom session-state module, you can use the HttpSessionStateContainer class, or supply your own implementation of the IHttpSessionState interface.

For an example of a custom session-state module that uses the HttpSessionStateContainer class as the session-state container for the current request, see the SessionStateUtility class overview.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.