代码如下:
1
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
2
3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5
<html xmlns="http://www.w3.org/1999/xhtml" >
6
<head runat="server">
7
<title>无标题页</title>
8
<script language="javascript">
9
10
function ClosePage()
11
>
在ClosePage.cs页面的 Page_Load销毁如下: Session.Abandon(); 2
3
4
5
6
7
8
9
10
11
注意:当刷新页面的时候也会触发onunload事件,所以需要判断是否进行关闭再执行Session的销毁操作。即:
if((window.screenLeft>=10000 && window.screenTop>=10000)||event.altKey)
{
}