Page 1 of 1
session timed out for my webpage
Posted: Thu Aug 13, 2009 1:15 am
by sobha
Hi,
How to do session timed out for my webpage if user does not access my webpage for a particular time interval.I want to display message as Your session has been timed out.Please login to access it.
Regards,
Sobha
Re: session timed out for my webpage
Posted: Thu Aug 13, 2009 9:54 am
by izzy4505
You need to keep track of users sessions on the back end in some way. I'd imagine if their session is timing out, then they are authenticated and logged in. Store the session ID as well as last touched date/time on the database with user information. If they hit another page after x minutes, then show them your "time expired" page and log them out.
Some sites will also use a javascript notification as they are approaching their time. My bank uses one with AJAX, so as you approach your time, you get a dialog box saying "Your time is about to expire, click OK to continue." Annoying as hell, but less annoying then getting logged out in the middle of your work.
Of course, you can't rely solely on Javascript methods... this is something that should ultimately be server-side.