Opening a new browser window with a new session ID in ASP.NET

I need to open a second browser window or tab, but it should have a different session ID .

Opening a new browser window on an ASP.NET page is very simple, but then it shares the same cookie and thus the session ID with the original.

How can i do this?

+6
cookies session
source share
3 answers

This is a browser limitation: browser instances share cookies (including cookies) when they are running, so this is not possible in your standard browser.

If you have the ability to run different browsers (e.g. IE and Firefox), they do not transmit cookies and will have different sessions.

Edit:

If you have control over the IIS and DNS host headers in your environment, you can use many different domain names โ€” one per session.

The browser will treat each domain name as a different server, and different cookies (and therefore sessions) will be created.

+6
source share

In IE, you should use File - New Session or there is a registry key that you can set for tabs / sessions. Your tabs will change color, showing you which session you are using.

+3
source share

I donโ€™t think there is a way to do this because Cookies are stored at the browser level, however when you open many windows you will still have the same Cookie and, therefore, the same session.

Perhaps, perhaps, if you are using a cookieless session , I'm not sure, although there are quite a few flaws in the way without cooki sessions.

edit: Depending on your circumstances, one way to achieve what you are trying to achieve can be several different domain names / URLs that all point to the same ASP.NET site, which allows you to save cookies and sessions separate. But if you need more than 2 or 3 sessions in the browser, then it will be stupid.

0
source share

All Articles