We are upgrading a web-based software from Windows XP with Internet Explorer 6 to Windows 7 with Internet Explorer 9.
Furthermore, a webbrowser object is used inside a WPF application.
We now have a strange behavior, when opening a window with a url (with an instruction like window.open(url)), the ASP session is "lost" and the new window works with a new from scratch session.
I solved this issue by avoiding useless windows opening and instead, I modify the location of the current window. But I would like to understand why this behavior !
Do you have any clue ?
Thank you.
This could be cause by a simple different in your domain name, if you are running on www.yoursite.com but the window points to yoursite.com then a new session will be created. A nasty one to catch so look out for it.
Additionally you might have some debug code floating around in a page somewhere, this can cause a lot of head scratching, clearing out a session variable for testing for instance. Something else to check for, long shot though but you never know.
Assuming your navigation all go to the same domain then another cause for this could be the switching of processes. As of IE8 the IE "chrome" and tab content were seperated into two processes. Further IE can create multiple content processes for content in different windows and tabs.
If your app is hosting a webbrowser control which then launches a full IE window, the chances are that your new URL is being requested by another process (iexpore.exe) not your apps process. As a result the request does not have access to session cookies hence the session appears "lost".
(Its worth noting that the multiple iexplore.exe process instances in the same process tree have a means of sharing session cookies with each other).
I think you are likely having the same problems that this answer addresses. Essentially it is probably due to Security Zone errors within IE on the specific computer you are using. As others have noted and I can reiterate, sessions are carried into other IE (6, 7, 8, 9) windows opened by javascript, as long as the domain is not changing.
Good luck!
Some references to help you:
When you open a new window using the javascript as default IE, create a new window, as well isn't the same session and history. If you get the last referrer from a javascript new window, it will come empty in major browsers.
And you can keep your session history if your window.open function is triggered inside an anchor object:
<script>
function windowOpen() { window.open("my_page.asp","_blank"); };
</script>
<a href="javascript:windowOpen();">my link</a>
来源:https://stackoverflow.com/questions/8472407/opening-a-new-window-create-a-new-session