Page.Session プロパティ
アセンブリ: System.Web (system.web.dll 内)



このプロパティは、現在の要求のセッションに関する情報を提供します。ASP.NET アプリケーションからページまたはドキュメントを要求するそれぞれのユーザーについて Session オブジェクトが保持されます。Session オブジェクトに格納されている変数は、ユーザーがアプリケーション内でページ間を移動しても破棄されません。ただし、これらの変数が保持されるのは、ユーザーがアプリケーション内のページにアクセスしている間だけです。セッション状態の詳細については、「ASP.NET のセッション状態」を参照してください。

Web フォームのページのセッション状態に格納されているキーを取得し、その値を文字列に変換する GetStyle 関数を作成するコード例を次に示します。
' Create a private function that obtains ' information stored in session state ' in the application's Global.asax file. ' When this method is called and a key name ' that is stored in session state is passed ' as the parameter, the key is obtained and ' converted to a string. Function GetStyle(Key As String) As String Return Session(Key).ToString() End Function
// Create a private function that obtains // information stored in Session state // in the application's Global.asax file. // When this method is called and a key name // that is stored in Session state is passed // as the paramter, the key is obtained and // converted to a string. String GetStyle(String key) { return Session[key].ToString(); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Page.Session プロパティのページへのリンク