ASP.NET and Sessions - New Browser Instance versus New Browser Window

限于喜欢 提交于 2019-12-04 05:23:32

Sessions in IIS/ASP.NET are based on cookies with a session scope, meaning that they get destroyed when the browser is closed, and apparently they are not shared within different processes of Internet Explorer.

When you open a new browser window with File > New Window the window will be handled by the same process as the first (i.e. the same iexplorer.exe). When you lauch IE from the start menu you get a new process, and you will now have two iexplorer.exe in the Task Manager. I think that it's only IE 7 that will spawn multiple processes.

As a side note, IE 8 will have have a single process per tab / window, like Google Chrome has. I don't know if these browsers share session cookies amongs the processes, but it's certainly something to keep in mind when testing using one of these browsers.

By default, ASP.NET tracks sessions through cookies. A new IE instance does not have the session cookie, resulting in a new session. However, using File -> New Window from an existing IE window will create a new window with the same cookies as the "parent", allowing ASP.NET to use the existing session.

I'd wonder if the new IE instance would have the same cookies that happen in case B, where while it is a new window it is using the same process. It is usually in the cookie or in the querystring that there is a value used to map sessions to various clients.

It would appear the session data is getting cached per process. A) and B) exist in the same process, whereas launching a new instance of IE will be creating a new process.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!