1、<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript">
function window.onunload()
{
if (event.clientX < 0 && event.clientY < 0)
window.open("logout.aspx","logout");
}
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
2、然后在在登出页面logout.aspx中。清楚session,自行关闭。
protected void Page_Load(object sender, EventArgs e)
{
Session.RemoveAll();
this.UpdateSession();
}
#region 更新信息
/// <summary>
/// 取营业厅信息
/// </summary>
private void UpdateSession()
{
try
{
Response.Write("<script>window.close()</script>");
}
catch (Exception ex)
{
string sx = ex.ToString();
return;
}
}
#endregion
在关闭事件中利用javascript登录到你定义的登出页面中,在登出页面中你可以编码 Session.RemoveAll();或session.abandon()来结束SESSION