PagesSection.EnableSessionState 属性

定义

获取或设置一个值,该值指定会话状态是启用、禁用还是只读。

public:
 property System::Web::Configuration::PagesEnableSessionState EnableSessionState { System::Web::Configuration::PagesEnableSessionState get(); void set(System::Web::Configuration::PagesEnableSessionState value); };
[System.Configuration.ConfigurationProperty("enableSessionState", DefaultValue="true")]
public System.Web.Configuration.PagesEnableSessionState EnableSessionState { get; set; }
[<System.Configuration.ConfigurationProperty("enableSessionState", DefaultValue="true")>]
member this.EnableSessionState : System.Web.Configuration.PagesEnableSessionState with get, set
Public Property EnableSessionState As PagesEnableSessionState

属性值

EnableSessionState 属性的某个值,指定会话状态为启用、禁用还是只读。 默认为 True,该值指示启用会话状态。

属性

例外

该值不是有效的 PagesEnableSessionState 枚举值。

示例

下面的代码示例说明如何使用 EnableSessionState 属性。

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

适用于

另请参阅