超时应该会触发,但在ASP.NET里时常不触发,不知是不是MS的bug示例代码 try (not always work, since the user can go to another site):<script language=javascript> function window.onunload() { if (event.clientX < 0 && event.clientY < 0) window.open("logout.aspx", "logout"); } </script>in logout.aspx: <% Session.Abandon() %>
First of all, Session_End event is supported only in InProc mode. In order for Session_End to be fired, your session state has to exist first. That means you have to store some data in the session state and has completed at least one request.
try (not always work, since the user can go to another site):<script language=javascript>
function window.onunload()
{
if (event.clientX < 0 && event.clientY < 0)
window.open("logout.aspx", "logout");
}
</script>in logout.aspx:
<% Session.Abandon() %>