PagesEnableSessionState 枚举

定义

用于确定单个网页或整个 Web 应用程序的会话状态激活。

public enum class PagesEnableSessionState
public enum PagesEnableSessionState
type PagesEnableSessionState = 
Public Enum PagesEnableSessionState
继承
PagesEnableSessionState

字段

False 0

会话状态被禁用。

ReadOnly 1

会话状态已启用,但不可写。

True 2

会话状态已启用。

示例

以下配置文件摘录演示如何以声明方式使用枚举的值 PagesEnableSessionState 来指定是否启用会话状态。

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

下面的代码示例演示如何将 PagesEnableSessionState 枚举与 类型一起使用 PagesSection

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

注解

此枚举确定整个 Web 应用程序的会话状态激活。 此值可用于配置文件部分, pages 以影响 Web 应用程序中配置文件范围的所有 .aspx 页面。 类型 PagesSection 允许以编程方式访问 pages 配置节。

适用于

另请参阅