How do to prevent user by viewing secured page by clicking back button when session expired..:)

Questions by atqpx

Showing Answers 1 - 4 of 4 Answers

Arindam

  • Nov 10th, 2005
 

You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.

<%

response.setHeader("Cache-Control","no-store"); //HTTP 1.1

response.setHeader("Pragma\","no-cache"); //HTTP 1.0

response.setDateHeader ("Expires", 0); //prevents caching at the proxy server

%>

  Was this answer useful?  Yes

Please correct me if I am wrong,


how about if we have a session.invalidate() method called during the logout button click.
And while going back we can just check request.getSession(false) if the session exists then we can continue working else we have a session expired error!

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions