开发者

What will happend to a session if user try to copy the address bar to a new IE window?

开发者 https://www.devze.com 2022-12-19 09:36 出处:网络
suppose one user logins to a web site and start navigating its pages. For a specific page, he copies page address and pastes it to a new IE window 开发者_运维技巧address bar.

suppose one user logins to a web site and start navigating its pages. For a specific page, he copies page address and pastes it to a new IE window 开发者_运维技巧address bar.

Now, what happens to his session? Does it duplicates? or what?


No, AFAIK, the SESSION cookie gets sent to the browser (the application as a whole, not the window). Each window references the same cookie information held by the browser (IE).

An oversimplified example:

Think of it as a database and a script. The database houses a bunch of information, which can be read by many scripts. That information is still housed in one place even though every script can do something with it.

The session cookie would be the database and the browser window the script.


I think it goes like this:

If the "new window" is opened with Ctrl-N in the first window, the same session exists in the "new window".

If the "new window" is opened by double-clicking on the IE icon, the first window's session doesn't come along for the ride.


Independent of the browser a new window or tab of the same browser uses the same session. Only another process will have a different session. For example copy the address to another browser like Firefox, and you will get a new session.


Opening a new window within the same browser is no different from the server's point of view than reloading the page in the current window. The session is the same and the server merely issues a response to the request. However if there were any POSTed fields in the original page request (for example, the user had performed some actions) these will not be sent with the new request.


Sessions are created and destroyed by the web browser on the server. So sessions are unique for each browser. That is no need to re-generate when using the same browser (if not log out)and need to re-generate when using a different browser from the first one. Therefore if copying the URL to the same browser before closing the current window, then it is same as the earlier session. But not if copying to a different browser, and in this case you will ask to log in again.

However if you have set the session to be closed when window is closed, then closing the browser will close the session and but closing the tab will not close the session because server keeps that browser is still live and then keep the session live.

0

精彩评论

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

关注公众号