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ののためにうまく動作するようだが、Firefoxので失敗しているようです。
はあなたがGlobal.asaxの中のSession_End機能で動作することができます試してみてください? [http://articles.techrepublic.com.com/5100-10878_11-5771721.html](http://articles.techrepublic.com.com/5100-10878_11-5771721.html) –
私は現在、 global.asaxファイルのApplication_Errorイベント。おそらく私のセッション処理もそこに属しています。しかし、どのように私は要求されたページの負荷でそれを使用するのですか? –