Reputation: 41
I Want to destroy a session in my project such that when I click on Logout, it goes to a page "KillSession.jsp" , in that file I've written "session.invalidate();" and then I redirect the user to the Login page. But if I use the back button on my browser, it goes back to the page I have visited before even when I've logged out. What to do?
Upvotes: 0
Views: 314
Reputation: 159754
Make sure that you don't cache the last page before you log out. You could do something like:
response.setHeader("Cache-Control","no-cache,no-store,must-revalidate");
response.setHeader("Pragma","no-cache");
response.setDateHeader("Expires", 0);
Upvotes: 0
Reputation: 240860
Your browser caches it, You need to add header to force your browser not to force it
Upvotes: 1