HttpSessionState.Contents Property

Gets a reference to the current session-state object.

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

public HttpSessionState Contents { get; }
/** @property */
public HttpSessionState get_Contents ()

public function get Contents () : HttpSessionState

Not applicable.

Property Value

The current HttpSessionState.

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 />");

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions