02-18-2003, 09:25 PM
I was looking up Session_onEnd on this forum and Eskimo had the problem that I am currently having so this should be fairly simple to answer.
In reference to Session_OnEnd. if the user clicks the X button of the browser or hits Alt+F4, Session_OnEnd is not executed. Or if they have a computer lock up (GPF for example) and they need to restart the computer, how does it know to release the session handle?
Currently, I have a datediff that logs you off automatically after 10 minutes of inactivity but that does not answer the question if a user hits the X button or a freeze occurs.
Would someone mind sharing the way to handle this?? I cannot find an answer anywhere.
Thank you for your help in advance.
02-18-2003, 11:22 PM
Thats always a problem.
The in the case of the user hitting the close button or their computer freezing, most servers have the session timeout set to 20 minutes. So in that case, 20 minutes after the last request was made from the client, the Session_OnEnd is ran and the client's session is terminated.
02-19-2003, 01:35 AM
I'll get my buddy KingB24 to help you out, if I can.
He solved this problem by researching the global.asa partially from my suggestions.
Of course, I am assuming you're using a database of some type, but I still haven't looked at his solution, since I was too busy at work today.
02-19-2003, 03:17 AM
I am currently using Access 2002 and plan to go to SQL Server 2000 in a few months after I learn the lingo. Thank you both oracleguy and whammy for your continued support thru thisd and whammy, I look forward to the answer from your friend.
02-26-2003, 10:54 AM
One technique that I've seen in a couple of sites and I tend to use is to track the session start and end in the database using the followind steps.
1. In the user table create 2 extra fields, loginDate and logoutDate.
2. When someone logs in, update the loginDate field with their login date and time
3. When they log out, update the logoutDate field with their logout date and time
4. When someone logs in again, you can do a check to see if logoutDate is less than loginDate - if it is then they didn't log out properly and you can just present them with a message to suggest they log out properly.
Make sure the message is a polite one though - if their machine crashed or the server died then it might not be their fault.
Another alternative is to do the same using a cookie rather than the database. Less database overhead, but since there isn't much processing or database overhead in the database route anyway I use that. Just means that if someone deletes the cookie you still have the information.
Hope that helps
02-27-2003, 12:48 AM
AHHH!!! Sorry I haven't been back to this post, I've been bogged down at work (and so has the other developer I mentioned). :(
Anyway regardless, the session will still end after 20 minutes by default if someone just closes their browser...
You've probably got it figured out by now, or are working on it... if you're still having problems let us know!