用户登陆时在建立session时我在application中增加了用户记数
在session_end中将application中的用户记数减掉1
会话结束时做判断通过 session_end
但是用户在关闭浏览器时并不会立即执行 此事件。

解决方案 »

  1.   

    使用单点登录、
    以上两种做法、
    一、可以使用定时检测程序有没有响应。
    二、在页面事件onunload中window.open("11.aspx"),然后在11.aspx里面将退出状态写入。
      

  2.   

    我用过的方法,就是在关闭窗口时强行弹出个Logout页面。
    主要就是用onbeforeunload而非onunload才能保证一定弹出<script language="javascript">
    <!--
    function window.onbeforeunload()
    {
    if(event.clientX>document.body.clientWidth&&event.clientY<0||event.clientY>document.body.clientHeight||event.altKey)
    {
    opened=window.open( "logout2.asp" , "logout" , "status = no" , "" );
    opened.moveTo( (screen.availWidth -160)/2 , (screen.availHeight -40)/2);
    opened.resizeTo(160,80);
    }
    }function window.onunload()
    {
    return true;
    }
    -->
    </script>