HttpSessionState.Mode 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會取得目前的會話狀態模式。
public:
property System::Web::SessionState::SessionStateMode Mode { System::Web::SessionState::SessionStateMode get(); };
public System.Web.SessionState.SessionStateMode Mode { get; }
member this.Mode : System.Web.SessionState.SessionStateMode
Public ReadOnly Property Mode As SessionStateMode
屬性值
這是其中一項 SessionStateMode 價值。
範例
以下程式碼範例將 session 屬性設 mode 為 Web.config SQLServer 檔案中。 對於SQL Server會話模式,也需要 sqlConnectionString 屬性。
<configuration>
<system.web>
<sessionState
mode="SQLServer"
sqlConnectionString="Data Source=localhost;Integrated Security=SSPI"
cookieless="true"
timeout="30" />
</system.web>
</configuration>
備註
關於如何設定伺服器為 StateServer 或 SQLServer 會話狀態儲存的資訊,請參見 ASP.NET 會話狀態概覽。