Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
       Application.Lock()
       Application("CurrentUsers") = Application("CurrentUsers") - 1
       Application.UnLock()
End Sub我的就可以阿.

解决方案 »

  1.   

    他有生命周期的。不是你关闭,它立即执行 session_onend
      

  2.   

    You misunderstood the concept of sessionsAn ASP.NET session lives on the server side, your closing a browser on the client side has no effect on it unless you specifically send a request to tell the server side that you are done with the session, or the session will expire after a specified period of timeyou could try something like the following:<script language="javascript">
    function window.onunload()
    {
      if (event.clientX < 0 && event.clientY < 0)
    window.open("logout.aspx","_blank");
    }
    </script>inside logout.aspx, call
    <%Session.Abandon()%>
    Note, this does not always work, since the user can go to another site.....
      

  3.   

    here are some articles in ASP, but the idea is sameCounting Active Users
    http://www.asp101.com/resources/active_users.aspActive User Count Without Global.asa
    http://www.aspfree.com/authors/josh_painter/activeusers.asp