IE7 problem - session and cookie problem

Tag: internet-explorer-7 Author: gcglz2009 Date: 2009-08-23

I have one problem with IE7. Let me explain the scenario

I have opened my web based application in IE7 browser in TAB1 by using normal login feature. After successful login, i entered to the application home page and i do with my normal transaction say Trans1. Now i want to open my application again in another tab TAB2 in the same browser window.. what happens IE7 won't allow me to login on my application in the login page, it directly enters to the home page and when i do one transaction say "Trans2" it is going smoothly. Now when i again went to the TAB1 and doing one transaction it is opening the TAB2 page that i opened in TAB2.

It seems IE7 is sharing same session cookie in multiple tabs. Is there a workaround for the same scenario.

Anyone have any solution for this problem.

Appreaciate your help in this regard.

Thanks, Manoja Swaro

Other Answer1

It seems IE7 is sharing same session cookie in multiple tabs. Is there a workaround for the same scenario.

Well no. Cookies are by design shared between all instances of the same browser, whether in multiple tabs or multiple windows. You can only get two separate sessions by using different browsers, like an instance of IE and one of Firefox.

This changes a little in IE8, but in quite a complicated way you probably don't want to rely on. See

This is why you should generally not be using cookies/sessions for keeping track of partially-completed transactions; one transaction will always interfere with the other. Better to either:

  • keep track of all incomplete transaction data in page/form data, like hidden fields
  • if that's too much data to keep passing back and forth, create an ID for the transaction that is remembered through page data, and store the actual data in the database.

You can also use a unique ID tied to the page to generate more unique cookie names, eg. 'preference.1234=foo' instead of just 'preference=foo', so that each instance will have its own cookies.

Other Answer2

Yes. IE shares session/cookie between tabs.

Try to run a new browser (i.e. from Start menu) -- it helped with older versions of IE and it works with my IE7.


Try to run a new browser -- How to check that my application is already opened in one tab. so that i can force the user to open my application in a new window. Also, i have to make the application for the older versions of IE. Thanks for your prompt reply.
I am sorry, but I have no idea how to check if web app is already opened in other tab. When I had problem like that in my app I just taught users how to open 2ed window and log as another user. Moreover -- if you open new browser window form working browser window it inherited session -- new browser window must be opened from Start menu or by clicking on IE icon.
I just want to let you know when i open my application in two differnet browser windows in IE7, there is no issues, my application is working fine. The issue is only when i open my application in tow different tabs in the same browser window.

Other Answer3

AFAIK This happens with all tabbed browsers (FF for example).


However, for IE new browser window does not inherit session, whereas for FF session is always inherited.

Other Answer4

Indeed, this is how all tabbed browsers work. Cookies are shared among all tabs. However they are not shared among multiple instances of the same application, but I doubt this will help you.

This is actually a serious problem for many applications. It is very difficult to keep track of the tabs - which are open, which are closed, when a new tab opens, and when an existing one makes a request.

There is one workaround I have found, but it's pretty messy. The idea is that you have to assign a unique ID to every tab yourself. Then, when a tab performs some actions, this ID has to be posted back to the server. Depending on the architecture of your application, the ID can be passed around in URLs or hidden form fields. If you're doing AJAX, this can make it easier to find a common place to add the ID. ASP.NET also has just one form at all times, so the hidden field is easy to do.

Naturally, on the server side you must check this ID and implement your own "tab sessions" based on it.