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

屬性值

HttpStaticObjectsCollection

HttpStaticObjectsCollection,包含 Global.asax 檔案中所宣告的物件。

範例

下列程式碼範例會列出 id 集合中 StaticObjects 物件的 和 物件類型。

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 在進程外 (SQLServerStateServer) ,將不會建立物件,而且不會新增至這個集合。

提供 StaticObjects 屬性以與舊版 ASP 相容。

適用於

另請參閱