Page Close Event with ASP.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a ASP.NET web app, and I can't find and event like "OnClose()" . But I need to know when the page is closed because I have to much to do when this happen...



Thanx in Advantage....
 
You'll need to write a clientside javascript that that handles the
"onunload" method to catch the event of the user navigating or closing the
browser (etc.. many things trigger this event - check the docs). But you'll
never have a guarantee that the method will actually be called - it depends
on the securitysettings etc of the client's browser. If the client has
disabled scripts - naturally it won't run.

But, WHY do you need to know when the user navigates away from a page? You
could probably solve this another way.


Arild

Hector Martinez said:
I have a ASP.NET web app, and I can't find and event like "OnClose()" .
But I need to know when the page is closed because I have to much to do when
this happen...
 
I'm making something like a chat, and I need to delete a user when he get out...


Is any better solution for that?
 
Yes.

Do not rely on this.

Have the user call in regularly, and when he does not report in for some
time, kill him.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
(CTO PowerNodes Ltd.)
 
Back
Top