logout problem

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.
 
M

Mr Newbie

Yes.

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

_doPostback('Controlname','');
 
G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top