• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Invalidation of JSP Session

 
Varsha Pardeshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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
 
Ajith George
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • 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.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set the following headers in your code

 
Varsha Pardeshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • 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.
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!