http - ASP.NETの期限切れのセッションを最適に検出するにはどうすればよいですか?

original title: "http - How do I best detect an ASP.NET expired session?"


I need to detect when a session has expired in my Visuial Basic web application. This is what I'm using...

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
    End If something...

End Sub

Note: CurrentSession.IsNew returns HttpContext.Current.Session.IsNewSession

This seems to work well for Internet Explorer, but seems to fail with Firefox.

Visuial Basic Webアプリケーションでセッションが期限切れになったことを検出する必要があります。これは私が使用しているものです... Protected Sub Page_Load(ByVal sender As Object、ByVal e As System.EventArgs)Handles Me ...


  • Translate

    Try the following

    If Session("whatever") IsNot Nothing Then