次の方法で共有


HttpSessionState.StaticObjects プロパティ

定義

ASP.NET アプリケーション ファイル Global.asax 内の <object Runat="Server" Scope="Session"/> タグによって宣言されたオブジェクトのコレクションを取得します。

public:
 property System::Web::HttpStaticObjectsCollection ^ StaticObjects { System::Web::HttpStaticObjectsCollection ^ get(); };
public System.Web.HttpStaticObjectsCollection StaticObjects { get; }
member this.StaticObjects : System.Web.HttpStaticObjectsCollection
Public ReadOnly Property StaticObjects As HttpStaticObjectsCollection

プロパティ値

Global.asax ファイルで宣言されたオブジェクトを含む HttpStaticObjectsCollection

次のコード例では、StaticObjects コレクション内のオブジェクトのidとオブジェクトの種類を一覧表示します。

foreach (System.Collections.DictionaryEntry de in Session.StaticObjects)
  Response.Write(de.Key + " is of type " + de.Value.GetType().ToString() + "<br />");
For Each de As System.Collections.DictionaryEntry In Session.StaticObjects
  Response.Write(String.Format("{0} is of type {1}<br />", de.Key, de.Value.GetType()))
Next

注釈

ページ上のオブジェクトがシリアル化をサポートせず、 Mode がアウトプロセス (SQLServer または StateServer) の場合、オブジェクトは作成されず、このコレクションには追加されません。

StaticObjects プロパティは、以前のバージョンの ASP との互換性のために提供されています。

適用対象

こちらもご覧ください