-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: Rohit_BD
Message 3 in Discussion
New Message on MumbaiUserGroup
How to handle browser close events in asp.net
Reply
Reply to Sender
Recommend
Message 2 in Discussion
From:
Rohit_BD
Well, that's not possible purely on server-side (i.e., in
code-behind or in <scr ipt runat='server'> tags because the browser only fires
an "onunload" client-side (i.e., inside the browser's context) event whenever
it is closing or the URL is changed. Also, it is possible (in client-side,
again) to check the closed status of a window that has been opened using the
window.open() method in JavaScript from the browser window that opened it. So
here's what you will have to do:
Create a simple HTML page with following:
<scr ipt language="javascript">
var myWin = window.open("<URL for your ASP.NET application start or main
page>");
function checkStatus()
{
if(myWin.closed)
{
//Call the page to kill session
location.href = "KillSession.aspx";
//Optional step
window.close();
}
else
{
//Check status every 100mS
setTimeout("checkStatus();", 100);
}
}
</scr ipt>
View other groups in this category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]