Search code examples
javaweb-applicationshttpwebrequesthttpsession

Same session is getting attached to seperate internet explorer windows while login?


I do the login to my java based application with admin credentials in one internet explorer window. Now i open one more seperate IE window and give my application home url i.e http://localhost:8888/myxwiki/ . I see in this second i am directly getting logged in with admin credentials which is not correct. I should see login screen on this second window here.

Then i did debugging and found out with both IE windows xwikicontext.getRequest().getSession() returning the same session( basically both sessions are having same session id). As per my understanding session is specific to browser window . so both windows(or request from diffent IE windows) should have different session attached to them.

Not getting how come both request fired from seperate browser windows are having same session id.


Solution

  • If you're identifying the current session using a cookie (such as the JSESSIONID cookie) then that cookie will be shared across all open browser windows.

    If I open a new tab or new window for a given website, my expectation would be for it to preserve my current session. Why do you expect differently?