共用方式為


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

適用於

另請參閱