HttpSessionState.StaticObjects 屬性

定義

取得由 ASP.NET 應用程式檔 Global.asax 內 <object Runat="Server" Scope="Session"/> 標記所宣告的物件集合。

public System.Web.HttpStaticObjectsCollection StaticObjects { get; }

屬性值

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 />");

備註

如果頁面上的物件不支援串行化,而且 Mode 不處理 (SQLServerStateServer) ,將不會建立物件,也不會加入至這個集合。

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

適用於

產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另請參閱