共用方式為


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 相容而提供。

適用於

另請參閱