Code As follows: 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 > No title page </ Title >
8 < Script Language = " Javascript " >
9
10 Function closepage ()
11 {
12 If (Window. screenleft > = 10000 && Window. screentop > = 10000 ) | Event . Altkey)
13 {
14Window. Location. href="/Closepage. aspx"
15}
16 }
17
18 </ Script >
19 </ Head >
20 < Body onUnload = " Closepage () " >
21 < Form ID = " Form1 " Runat = " Server " >
22 < Div >
23 < ASP: button ID = " Button1 " Runat = " Server " Onclick = " Button#click " Text = " Button " /> </ Div >
24 </ Form >
25 </ Body >
26 </ Html >
The page_load on the closepage. CS page is destroyed as follows: Session. Abandon ();
Note: The onUnload Event is also triggered when the page is refreshed. Therefore, you need to determine whether to close the page and then destroy the session. That is:
If (window. screenleft> = 10000 & window. screentop> = 10000) | event. altkey)
{
}
0 0
0
(Please Article Make comments)