asp中如何使用session

2024-12-15 23:10:27
推荐回答(1个)
回答1:

举个例子,希望对你有帮助
Sub Session_Add(sender As Object, e As EventArgs)
Session("MySession") = text1.Value
span1.InnerHtml = "Session data updated!

Your session contains: " & \
Session("MySession").ToString() & "
"
End Sub

Sub CheckSession(sender As Object, eAs EventArgs)
  If (Session("MySession")Is Nothing) Then
span1.InnerHtml = "NOTHING, SESSION DATA LOST!"
  Else
span1.InnerHtml = "Your session contains: " & \
Session("MySession").ToString() & "
"
End If
End Sub


 
  value="Add to Session State" id="Submit1"name="Submit1">
        value="View Session State" id="Submit2"name="Submit2">