8
我需要在我的Visuial Basic Web應用程序中檢測會話何時到期。這是我使用的是什麼...如何最好地檢測ASP.NET過期會話?
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
注:CurrentSession.IsNew
回報HttpContext.Current.Session.IsNewSession
這似乎也爲的Internet Explorer工作,但似乎失敗火狐。
你能在Global.asax中的Session_End中功能工作? [http://articles.techrepublic.com.com/5100-10878_11-5771721.html](http://articles.techrepublic.com.com/5100-10878_11-5771721.html) – 2008-08-06 18:45:56