This documentation is archived and is not being maintained.

SessionStateItemCollection Class

A collection of objects stored in session state. This class cannot be inherited.

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

[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class SessionStateItemCollection sealed : public NameObjectCollectionBase, 
	ISessionStateItemCollection, ICollection, IEnumerable

The SessionStateItemCollection class is used to manage session-state variable values indexed by a variable name or by numerical index. The session-state variables are exposed to ASP.NET application code using the HttpSessionState class, which is accessed using the Session property of the current HttpContext or the Page. The HttpSessionState class calls the HttpSessionStateContainer class, which manages session-state variable values using the SessionStateItemCollection.

Notes to Implementers:

When you create a custom session-state provider based on the SessionStateStoreProviderBase class, use the SessionStateItemCollection class to manage the items stored in session state. If you need to create a custom object to manage session-state items, implement the ISessionStateItemCollection interface.

The following code example creates a new SessionStateItemCollection object and sets and gets values in the collection by name.

No code example is currently available or this language may not be supported.


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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0