views:

237

answers:

2

Hello,

I would like to create a .NET application that utilizes multiple instances of the WebBrowser control. The catch is that I'd like each web browser control to be running it's own session. IOW, I have a requirement that the collection of session cookies, javascript global namespace, etc. is separate for each instance and that all instances appear within the same window.

AFAIK, this is going to require me to run each web browser control in a separate process.

A few questions:

  1. Is my assumption about multiple processes being required correct?
  2. Is it possible to cause each WebBrowser instance in a single Windows Forms app to run in a separate process?

Thanks in advance...

+1  A: 

Currently, no, you cannot implement isolation of this sort using the Web Browser control without putting each instance in a different process.

You could run each control in an out-of-process COM server or a new instance of your application, if appropriate.

EricLaw -MSFT-
A: 

It is possible to do that if you can access the hosts file ([Windows]/system32/drivers/etc/hosts).

Just put something like this into the hosts file:

127.0.0.1 web1
127.0.0.1 web2
127.0.0.2 web3
...

(replace the ip address with your server ip) and then you can point your multiple instances of WebBrowser to e.g. http://web1/.., etc. Each instance of the WebBrowser will run a separate session. It works fine. The disadvantage is that you need to (programmaticaly) manage hosts file, which could be a security problem as well.

Boris Kalinin