Bagikan melalui


HttpSessionState.StaticObjects Properti

Definisi

Mendapatkan kumpulan objek yang dideklarasikan oleh <object Runat="Server" Scope="Session"/> tag dalam file aplikasi ASP.NET Global.asax.

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

Nilai Properti

Objek HttpStaticObjectsCollection yang berisi dideklarasikan dalam file Global.asax.

Contoh

Contoh kode berikut mencantumkan id jenis objek dan dari objek dalam StaticObjects koleksi.

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

Keterangan

Jika objek pada halaman tidak mendukung serialisasi dan Mode di luar proses (SQLServer atau StateServer), objek tidak akan dibuat dan tidak akan ditambahkan ke koleksi ini.

Properti StaticObjects disediakan untuk kompatibilitas dengan versi ASP yang lebih lama.

Berlaku untuk

Lihat juga