logout problem

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

after user log out from my web site, I need to save what time they logged out to
database.
Here is my problem: if they click 'log out' button before they close web
browser, it is works fine; but if they did not click 'log out' buttom, they just
close web browser, it will not save data to database even I put code into
Page_Unload section.
any suggestions?
Thanks.
 
Yes.

Do a postback on the windows 'onUnload' event in Javascript and force the
logout. Something similar to this.

_doPostback('Controlname','');
 
Jason,
Page_UnLoad is executed at the end of the page life cycle , not when the
user close the page. this event is useful to clean any objects/recources used
at the page level.

Using Session_End event to record time is one option. But as you are
probabaly aware, the Session_End doesnt fire immediatly when a user leaves..
it fires only after the session expire time is passed (default 20 mins)
 
Back
Top