PagesEnableSessionState Enumeration
Collapse the table of content
Expand the table of content

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

Session state is disabled.


Session state is enabled, but not writable.


Session 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.

  <pages enableSessionState="true" />

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

// Get the current EnableSessionState property value.
    "Current EnableSessionState value: '{0}'",

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

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft