I need to open a second browser window or tab, but it must have a different session ID
.
Opening the new browser window from an ASP.NET page is easy, but then it shares the same cookie and thus session ID
with the original.
How can I do this?
1 Answer. Show activity on this post. Opening a new tab doesn't start a new session if the same site is already open in the same browser. The browser tries to use the existing session.
A session ID is a unique number that a Web site's server assigns a specific user for the duration of that user's visit (session). The session ID can be stored as a cookie, form field, or URL (Uniform Resource Locator). Some Web servers generate session IDs by simply incrementing static numbers.
By default, ASP.NET allows you to reuse a session identifier. For example, if you make a request and your query string contains an expired session, ASP.NET creates a new session and uses that session ID.
Remarks. The SessionID property is used to uniquely identify a browser with session data on the server. The SessionID value is randomly generated by ASP.NET and stored in a non-expiring session cookie in the browser. The SessionID value is then sent in a cookie with each request to the ASP.NET application.
In IE you have to use File - New Session or there is a registry key you can set for tabs / sessions. Your tabs will change color showing you which session you are using.
This is a browser limitation - browsers instances share cookie data (including session cookie) when they are running, so this is not possible with your standard browser.
If you have an option of running different browsers (IE and Firefox, for instance) they do not share cookies and will have different sessions.
Edit:
If you have control over IIS host headers and DNS in your environment, you may be able to 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With