| Author |
Clearing the session.
|
Patrick Nshimba
Greenhorn
Joined: Nov 15, 2010
Posts: 3
|
|
Hi,
my name is Patrick and im new in Java script, im designing a website as part of my final year project,
i have a problem with the sessions, how can i clear the session when i don't log off but just use the browser back button,
so that when i want to go back to that page , it must take me to the login page.?
Help needed quickly.
|
 |
Praneeth Yeri
Greenhorn
Joined: Oct 07, 2010
Posts: 11
|
|
I am assuming that you are using a J2EE Server to serve your web pages. You should always provide a Session time out in the web.xml. If a user tries to close a window, without properly logging off, then the container automatically kills the sessions which are past the session time out.
Also if you feel that you should be redirecting to the login page, if there is no session, then have a filter in the web.xml that checks for valid session and performs the redirect.
|
 |
Patrick Nshimba
Greenhorn
Joined: Nov 15, 2010
Posts: 3
|
|
|
Hi Praneeth Yeri, is there any script that is there as an example i can refer to?
|
 |
Praneeth Yeri
Greenhorn
Joined: Oct 07, 2010
Posts: 11
|
|
For mentioning the Session Time out in web.xml, You can do the following in the web.xml file.
Where session-timeout
<session-timeout>: The timeout for a session in minutes.
|
 |
Patrick Nshimba
Greenhorn
Joined: Nov 15, 2010
Posts: 3
|
|
sorry im using php and java scripts.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Java and JavaScript are two different things.
The back button retrieves the page from the user's cache. There is no way to prevent it when you do not set the proper no cache headers. http://www.mnot.net/cache_docs/
Eric
|
 |
 |
|
|
subject: Clearing the session.
|
|
|