共用方式為


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,包含 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 相容。

適用於

另請參閱