views:

107

answers:

2

I have a Windows forms application written in VB.NET where I host multiple WebBrowser controls in the same window. The problem I'm having is that the session for each WebBrowser control seem to get "crossed" when making asynchronous requests, such as when loading images. For instance, I have WebBrowser1 that loads an HTML document and WebBrowser2 that loads another HTML document. WebBrowser1 hosts an image that's served up by an ASHX page and is dependent on the browser session. The problem is that when the request is made for the image in WebBrowser1, the server actually receives the session ID from WebBrowser2. Is there a way to force each WebBrowser control to have a unique session?

+1  A: 

The WebBrowser control is essentially just an embedded version of IE. If you launch the regular IE, log into a website, then launch a second copy of IE and visit the website you'll find yourself already logged in with the second instance because IE shares cookies across instances. The same is true of the WebBrowser control. If fact, if you log into a website with IE and then have the WebBrowser control go there you'll find that its been logged in, too, since the cookies are all shared.

So basically, AFAIK, you can't do what you want.

Chris Haas
A: 

Hi,

I am suffering from exactly the same issue. Tried putting in a sleep of 500 ms in between two respective requests for the two webbrowser controls. Did help in reducing the issue but didn't completely solved it. Depending on website traffic I still have this random issue.

Isn't there a way where i can force the second webbrowser to initiate a new session?

Ritesh