Session.Contents("key") 與 Session("key") 等價。簡易計數器:
Session.Contents("counter") = Session.Contents("counter") + 1
Response.Write "您是第 " & Session.Contents("counter") & " 次來訪!"
在 global.asa 宣告:
<OBJECT RUNAT="Server" SCOPE="Session" ID="MyObj" PROGID="Some.Component"></OBJECT>
遍歷:
For Each obj In Session.StaticObjects
Response.Write obj & ": " & Session.StaticObjects(obj) & "<br>"
Next
Session 物件提供用戶層級資料隔離,是購物車、登入狀態、個人化設定等功能的核心基礎設施。