PagesSection.EnableSessionState Property

Gets or sets a value that specifies whether the session state is enabled, disabled, or read-only.

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

Public Property EnableSessionState As PagesEnableSessionState
Dim instance As PagesSection
Dim value As PagesEnableSessionState

value = instance.EnableSessionState

instance.EnableSessionState = value
/** @property */
public PagesEnableSessionState get_EnableSessionState ()

/** @property */
public void set_EnableSessionState (PagesEnableSessionState value)

public function get EnableSessionState () : PagesEnableSessionState

public function set EnableSessionState (value : PagesEnableSessionState)

Not applicable.

Property Value

One of the values for the EnableSessionState property, which specifies whether the session state is enabled, disabled, or read-only. The default is True, which indicates that session state is enabled.

Exception typeCondition


The new value is not a valid PagesEnableSessionState enumeration value.

The following code example shows how to use the EnableSessionState property.

' Get the current EnableSessionState property value.
Console.WriteLine( _
    "Current EnableSessionState value: '{0}'", pagesSection.EnableSessionState)

' Set the EnableSessionState property to
' PagesEnableSessionState.ReadOnly.
pagesSection.EnableSessionState = PagesEnableSessionState.ReadOnly

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