开发者

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

I need to ope开发者_运维知识库n 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?


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.


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.


I don't think there is a way of doing this, because Cookies are stored at the browser level - however many windows you open, you'll still have the same Cookie, and hence the same session.

Perhaps it is possible if you use Cookieless sessions, I'm not sure, although there's quite a few disadvantages to the cookieless sessions route.

edit: Depending on your circumstances, one way to achieve what you're trying to achieve might be to have several different domain names/urls that all point to the same ASP.NET site, that will allow you to keep the cookies and sessions separate. But if you need more than 2 or 3 sessions per browser then thats going to get silly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜