Session_OnEnd() will not be called if the user just closed his window and will be called when the Session times out1. in your page (not always work, for example, when the user browser away from your site)
<script language="javascript">
function window.onunload()
{
if (event.clientX < 0 && event.clientY < 0)
window.open("logout.aspx","logout");
}
</script>in logout.aspx, call
<%
Session.Abandon()
%>2. use a method which doesn't use Session_OnStart/Session_OnEnd, for example, keep a DataTable in an Application variable and record users' last access time, the DataTable is checked every time a user sends a request, if the access time for any user was 10 minutes ago, you remove the user from the DataTable
<script language="javascript">
function window.onunload()
{
if (event.clientX < 0 && event.clientY < 0)
window.open("logout.aspx","logout");
}
</script>in logout.aspx, call
<%
Session.Abandon()
%>2. use a method which doesn't use Session_OnStart/Session_OnEnd, for example, keep a DataTable in an Application variable and record users' last access time, the DataTable is checked every time a user sends a request, if the access time for any user was 10 minutes ago, you remove the user from the DataTable
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货