• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding Invalidation of JSP Session

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

Currently, I am facing the problem is that when I logout of the application, I am still able to access a page by typing the URL of the page into the browser.

For example,
http://localhost:8080/appname/createuser.jsp
[url=http://localhost:8080/appname/userreport.jsp?id=%27M7681%27]http://localhost:8080/appname/userreport.jsp?id='M7681'[/url]

when user clicks on logout option heis redirected to a jsp page where the
session.invalidate(); is used. But it doesn't help to overcome this problem.

Can anyone help me for avoiding this situation?

Thanks in advanced.

Regards,
Varsha Pardeshi
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
session.invalidate() only ensures that the session used by the loged in client destroys, but this will not prevent him from reaching another page on the server. For preventing you must check for proper session value on that page. In your case i think there is no proper checking for session values in the page you loaded after logout. Chek this out.
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set the following headers in your code

 
Varsha Pardeshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vishnu Prakash:
set the following headers in your code



Hello Vishnu,
Thanks for your reply. I had added the code for header, still my problem has not solved. Please can you give some details about this?

Regards,
Varsha Pardeshi
 
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest that you should not only depend of pages not being cached. I would suggest as suggested earlier by Ajith. Use some logic in the JSP's that makes sure that the pages you are trying to open do have a session value set.
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Varsha, when user login, put session.setAttribute(�validLogin�,�true�) and when user logout put session.setAttribute(�validLogin�,�false�)

You need to have a filter that check for values of validLogin for each request. If value found false, redirect to some another page, if values found true let request to be processed.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic