使用英语阅读

通过


PagesSection.EnableSessionState 属性

定义

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

[System.Configuration.ConfigurationProperty("enableSessionState", DefaultValue="true")]
public System.Web.Configuration.PagesEnableSessionState EnableSessionState { get; set; }

属性值

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;

适用于

产品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另请参阅