I need to detect when a session has expired in my Visuial Basic web application. This is what I'm using...
我需要在Visuial Basic Web应用程序中检测会话何时到期。这就是我正在使用的......
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If CurrentSession.IsNew AndAlso (Not Page.Request.Headers("Cookie") Is Nothing) AndAlso (Page.Request.Headers("Cookie").IndexOf("ASP.NET_SessionId") >= 0) Then
Response.Redirect("TimeOut.aspx")
End If
...do something...
End Sub
Note: CurrentSession.IsNew
returns HttpContext.Current.Session.IsNewSession
注意:CurrentSession.IsNew返回HttpContext.Current.Session.IsNewSession
This seems to work well for Internet Explorer, but seems to fail with Firefox.
这似乎适用于Internet Explorer,但似乎与Firefox失败。
1 个解决方案
#1
8
Try the following
请尝试以下方法
If Session("whatever") IsNot Nothing Then
#1
8
Try the following
请尝试以下方法
If Session("whatever") IsNot Nothing Then