to call Session_End() event when user closed Browser
Here's the steps:
</body>
2. In the head of .aspx page, add the following code to load another page to do clearance jobs. In the following codes, it would transfer to clearance.aspx page, and in the Page_Load() of clearance.aspx, we could do clearance job, or fire the Session_End() event by abandon Session.
<script language ="javascript">
function CloseWindow()
{
window.location = '../clearance.aspx';
alert('You are about to close the window');
}
</script>
3.in the Page_Load() of Clearance.aspx, add the following code to fireup Session_End() or do clearance(Attention, make sure your web application is in the In-Proc Session mode, web.config use In-Proc Session mode by default).
HttpContext.Current.Session.Abandon();
// to do clearance bellow:
// ...
Reference:
http://gridviewguy.com/ArticleDetails.aspx?articleID=108
posted on 2005-09-21 11:40 davidullua 阅读(1826) 评论(2) 收藏 举报
浙公网安备 33010602011771号