PagesEnableSessionState 枚举

定义

用于确定单个网页或整个 Web 应用程序的会话状态激活。Used to determine session-state activation for a single Web page or an entire Web application.

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

字段

False 0

会话状态被禁用。Session state is disabled.

ReadOnly 1

会话状态已启用,但不可写。Session state is enabled, but not writable.

True 2

会话状态已启用。Session state is enabled.

示例

以下配置文件节选显示了如何以声明方式使用PagesEnableSessionState枚举的值来指定是否启用会话状态。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>  
  

下面的代码示例演示如何对PagesEnableSessionState PagesSection类型使用枚举。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;
' 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 应用程序的会话状态激活。This enumeration determines session-state activation for an entire Web application. 此值可在pages配置文件部分中使用, 以影响配置文件范围内 Web 应用程序中的所有 .aspx 页。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. 类型允许以编程方式访问配置节。 pages PagesSectionThe PagesSection type allows programmatic access to the pages configuration section.

适用于

另请参阅