Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在這裡放置使用者程式碼以初始化網頁
Response.Write("列出所有Session變數")
Response.Write("
")
If IsNothing(Session("user")) Then
Session("user") = "User的基本資料"
End If
Session("Time") = "8/2/2004"
Session("name") = "王大毛"
Response.Write(Session("user") & "
")
Response.Write("SessionID = " & Session.SessionID & "
")
Response.Write("------------------------------------
")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'所有資料
Dim i As Int16
Response.Write("所有Session變數的資料:" & "
")
For i = 0 To Session.Contents.Count - 1
Response.Write(Session.Contents(i) & "
")
Next
End Sub