How to invalidate browser session?

Those headers are incomplete. This would only work in Internet Explorer, but would fail in others. The complete set is.

Up vote 0 down vote favorite share g+ share fb share tw.

How can I invalidate Browser Session. I am using JSP's. In web.

Xml the session-timeout is been set to 180 seconds and I want it like that only. But the problem is on some special occasion for some user's browser session need to be invalidated immediately right after a form submit. I have used session.invalidate(); to invalidate session and also used response.

SetHeader("Cache-Control", "no-cache"); response. SetHeader("Pragma", "no-cache"); response. SetDateHeader("Expires", 0); But, still when I click the back button it will take me to the same users session.

Is this loading from browser cache? This is what I have in my JSP : " name="submitFrm" id="submitFrm"> ' /> Am I missing something? Java jsp session browser invalidate link|improve this question edited Mar 23 '11 at 5:03BalusC263k27273487 asked Mar 22 '11 at 6:29Warrior4012617 94% accept rate.

It looks like browser cache. After you click on Back button, try adding a random number to your URL like rand=234234 & refresh. If it does not redirect to login page (if you have the authentication setup) then your session in validation would not have happened.

May be on form load you can have an AJAX heart beat to check if your still in active session that can beat the browser cache. – isobar Mar 22 '11 at 7:03.

Those headers are incomplete. This would only work in Internet Explorer, but would fail in others. The complete set is response.

SetHeader("Cache-Control","no-cache,no-store,must-revalidate"); response. SetHeader("Pragma","no-cache"); response. SetDateHeader("Expires", 0); And you also need to set them in the previous JSP pages as well.

Calling this inside a JSP would only disable caching the current JSP page. You need to copypaste it over all JSP pages (shudder). Or even better, use a Filter for this which is mapped on *.jsp.

For an example, see this answer.

As you said ,onclicking back button session is getting invalidate. SO please make session invalidate session on Back button event. I hope below code can help you.

Please add "" for first and lasr line in code snippet script type="text/javascript" bajb_backdetect. OnBack = function() { alert('You clicked it! '); } script.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions