PagesEnableSessionState PagesEnableSessionState PagesEnableSessionState PagesEnableSessionState Enum

定义

用于确定单个网页或整个 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
继承
PagesEnableSessionStatePagesEnableSessionStatePagesEnableSessionStatePagesEnableSessionState

字段

False False False False 0

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

ReadOnly ReadOnly ReadOnly ReadOnly 1

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

True True True 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. PagesSection类型允许以编程方式访问pages配置节。The PagesSection type allows programmatic access to the pages configuration section.

适用于

另请参阅