Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Session_onEnd

  1. #1
    New Coder
    Join Date
    Jan 2003
    Location
    Georgia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Session_onEnd

    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.

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    New Coder
    Join Date
    Jan 2003
    Location
    Georgia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Database Answr

    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.

    Thanks, Phillip

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    London
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tracking sessions

    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

    dominicall
    dominicall - confusing himself more and more each day

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •