HttpSessionState.Contents Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets a reference to the current session-state object.

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

public HttpSessionState Contents { get; }

The Contents property is provided for compatibility with earlier versions of ASP.

The following code example lists the item names and values in the Contents property.

foreach (string s in Session.Contents)
  Response.Write(s + " = " + Session[s].ToString() + "<br />");

.NET Framework
Available since 1.1
Return to top