SessionStateSection クラス
アセンブリ: System.Web (system.web.dll 内)
SessionStateSection クラスは、Machine.config または Web.config の各構成ファイル内の sessionState タグで識別される要素を参照します。
新しいクライアントが Web アプリケーションとの対話を開始すると、セッション ID が発行され、この ID と、そのセッションが有効な間に発生する同じクライアントからの以降のすべての要求とが関連付けられます。この ID は、クライアント セッションに関連付けられているサーバー側の状態を維持するために、すべての要求において使用されます。SessionStateSection は、ASP.NET アプリケーションが、各クライアントに代わって、この関連付けをどのように確立して維持するかを制御します。
このメカニズムはきわめて柔軟性が高いため、セッション状態情報をプロセス外にホストし、Cookie を使用しないで状態を追跡するなどの処理を実行できます。
このセクションには、2 つのコード例が用意されています。最初の例では、sessionState セクションの複数の属性に対して、宣言によって値を指定する方法を示しています。これらの属性には、SessionStateSection クラスのメンバとしてもアクセスできます。2 番目の例では、T:System.Web.Configuration.SessionStateSection クラスの使用方法を示します。
次の構成ファイルの例では、sessionState セクションに対して、宣言によって値を指定する方法を示します。
<configuration> <system.web> <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" stateNetworkTimeout="10" sqlConnectionString="data source=127.0.0.1; Integrated Security=SSPI" sqlCommandTimeout="30" customProvider="" cookieless="UseDeviceProfile" cookieName="ASP.NET_SessionId" timeout="20" allowCustomSqlDatabase="False" regenerateExpiredSessionId="False" partitionResolverType="" useHostingIdentity="True"> <providers> <clear /> </providers> </sessionState> </system.web> </configuration>
T:System.Web.Configuration.SessionStateSection クラスの使用方法を次のコード例に示します。
' Get the Web application configuration. Dim configuration As System.Configuration.Configuration = _ System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest") ' Get the section. Dim sessionStateSection As System.Web.Configuration.SessionStateSection = _ CType(configuration.GetSection("system.web/sessionState"), _ System.Web.Configuration.SessionStateSection)
// Get the Web application configuration object. System.Configuration.Configuration configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest"); // Get the section related object. System.Web.Configuration.SessionStateSection sessionStateSection = (System.Web.Configuration.SessionStateSection) configuration.GetSection("system.web/sessionState");
System.Configuration.ConfigurationElement
System.Configuration.ConfigurationSection
System.Web.Configuration.SessionStateSection
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
- SessionStateSection クラスのページへのリンク