A collection of objects stored in session state. This class cannot be inherited.
Namespace:
System.Web.SessionState
Assembly:
System.Web (in System.Web.dll)
Visual Basic (Declaration)
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class SessionStateItemCollection _
Inherits NameObjectCollectionBase _
Implements ISessionStateItemCollection, ICollection, IEnumerable
Dim instance As SessionStateItemCollection
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class SessionStateItemCollection : NameObjectCollectionBase,
ISessionStateItemCollection, ICollection, IEnumerable
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class SessionStateItemCollection sealed : public NameObjectCollectionBase,
ISessionStateItemCollection, ICollection, IEnumerable
public final class SessionStateItemCollection extends NameObjectCollectionBase implements 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.
Dim items As SessionStateItemCollection = New SessionStateItemCollection()
items("LastName") = "Wilson"
items("FirstName") = "Dan"
For Each s As String In items.Keys
Response.Write("items(""" & s & """) = " & items(s).ToString() & "<br />")
Next
SessionStateItemCollection items = new SessionStateItemCollection();
items["LastName"] = "Wilson";
items["FirstName"] = "Dan";
foreach (string s in items.Keys)
Response.Write("items[\"" + s + "\"] = " + items[s].ToString() + "<br />");
System..::.Object
System.Collections.Specialized..::.NameObjectCollectionBase
System.Web.SessionState..::.SessionStateItemCollection
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
Reference
Other Resources