1. I want to update database as soon as my session expires/timeout.
2. And when browser is closed.
I have table login_detail with field login_sts. when someone logs in value changes to 1 and when someone loges out value changes to 0. my problem is that if smone logs in, but doesnt signout and his session expires or he closes the browser, still login_sts will contain value 1(as he has nt loged out).
I want to update value on session expire or close of browser.
I tried to update it on session_end in global.asax, but failed.
and could not code for browser close update.
Loading
Andrew FensterPosted Jul 18, 2011, 3:55 PM
Suppose you have a session timeout of 20 minutes, and you have a master page or base page. When someone logs in, you record the time when they logged in. Each time they do a postback, you update this time to the current time. So for each user, you have a record of the last time they did a postback. Then you add a process that runs periodically that finds all the users who haven't had a postback in over 20 minutes and you log them out.
It's kind of ugly, but it might work.