本文介绍了Session_OnEnd事件不会自动触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么在关闭浏览器时未调用session_end事件?
关闭浏览器而不使用session.abandon()时,无法调用session_End事件.我的代码如下:
global.asax页面:
Why is the session_end event not getting called when we close a browser?
I am unable to call the session_End event when I close the browser without using session.abandon(). I have my code below:
global.asax page:
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim tracker As SessionTracker
tracker = Session("Tracker")
Console.WriteLine("sasikumar")
'kick out if there is no session data
If IsNothing(tracker) Then
Exit Sub
Else
MailUtil.SendSessionEndAlert(tracker)
Console.WriteLine("ramuksasi")
End If
Catch
End Try
End Sub
MailUtil.SendSessionEndAlert(tracker)页面:
MailUtil.SendSessionEndAlert(tracker) page:
Private Shared Function createTrackerMessageBody(ByVal tracker As SessionTracker) As String
Dim Host, Referrer, UserAgent, Crawler, Browser, URL1, VisitCount, OriginalReferrer, OriginalURL As String
URL1 = tracker.SessionURL
Browser = tracker.Browser.Browser
Crawler = tracker.Browser.Crawler
Referrer = tracker.SessionReferrer
VisitCount = tracker.VisitCount
OriginalReferrer = tracker.OriginalReferrer
OriginalURL = tracker.OriginalURL
Host = tracker.SessionUserHostAddress
UserAgent = tracker.SessionUserAgent
Return 0
End Function
您能帮我如何调用session_End事件吗?
提前谢谢.
问候,
Sasikumar
Can you help me how to call the session_End event?
Thanks in advance.
Regards,
Sasikumar
推荐答案
这篇关于Session_OnEnd事件不会自动触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!