Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clearing the session.

 
Patrick Nshimba
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praneeth Yeri, is there any script that is there as an example i can refer to?
 
Praneeth Yeri
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry im using php and java scripts.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic