Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple WebBrower sessions / processes in one window

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...

like image 639
Justin Voshell Avatar asked Jun 26 '09 21:06

Justin Voshell


People also ask

Why are there multiple Chrome processes in Task Manager?

You may have noticed that Google Chrome will often have more than one process open, even if you only have one tab open. This occurs because Google Chrome deliberately separates the browser, the rendering engine, and the plugins from each other by running them in separate processes.

How do I stop Chrome from running multiple processes?

To launch Chrome Task Manager press Shift+Esc keys on your keyboard or you can go via Settings > More tools > Task Manager. Select the task you want to terminate and click on End process.

Why browser opens multiple processes?

Open Fewer Tabs Chrome opens separate processes for every tab, renderer, and extension running in the browser. Obviously, a straightforward solution is to open fewer tabs. If you no longer need a tab, hit the X button to close it. Keeping tens of tabs open won't make you more productive, on the contrary.

When I open Chrome there are multiple processes?

You may often see multiple Google Chrome processes even when one tab is open. It's because, while you view it as a single entity, Chrome runs everything in a separate process, be it the browser, plug-ins, or rendering engine.


1 Answers

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.

like image 65
Boris Kalinin Avatar answered Sep 21 '22 18:09

Boris Kalinin