Export (0) Print
Expand All
Expand Minimize

PagesEnableSessionState Enumeration

Used to determine session-state activation for a single Web page or an entire Web application.

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

public enum PagesEnableSessionState

Member nameDescription
FalseSession state is disabled.
ReadOnlySession state is enabled, but not writable.
TrueSession state is enabled.

This enumeration determines session-state activation for an entire Web application. This value can be used in the pages configuration-file section to affect all .aspx pages in the Web application for the scope of the configuration file. The PagesSection type allows programmatic access to the pages configuration section.

The following configuration file excerpt shows how to declaratively use values of the PagesEnableSessionState enumeration to specify whether the session state is enabled.

<system.web>
  <pages enableSessionState="true" />
</system.web>

The following code example shows how to use the PagesEnableSessionState enumeration with the PagesSection type.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft