📄 usesessionsolved.aspx
字号:
<%@ Import Namespace="System.Net" %>
<%@ Page Debug="true" %>
<Script Language="VB" runat="Server">
Private _cookieJar As CookieCollection
Public Sub Page_Load(sender As Object, e As EventArgs)
Dim sessionExample As New SessionStateExample()
Dim sessionCookie As Cookie
Dim cookieContainer As New CookieContainer()
Dim cookieCollection As New CookieCollection()
sessionExample.CookieContainer = cookieContainer
sessionCookie = CType(session("sessionCookie"), Cookie)
If (IsNothing(sessionCookie)) Then
sessionExample.SetSession("name", "rob")
cookieCollection = sessionExample.CookieContainer.GetCookies(New Uri("http://localhost"))
Session("sessionCookie") = cookieCollection("ASP.NET_SessionId")
Else
sessionExample.CookieContainer.Add(sessionCookie)
End If
lblSession1.Text = sessionExample.GetSession("name")
End Sub
</Script>
<Font face=arial>
Value: <asp:label id="lblSession1" runat="server"/>
</Font>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -