Using Proxy with web browser control
is it possible to use two web browser c开发者_开发百科ontrols with different proxies without writing the registry.
or there might be any solution ?
You cannot do this with the Web Browser Control. InternetSetOption allows you to set a proxy, but your choices are only "For all processes" or "For this process". You cannot set the proxy individually for a single control. If there's something distinct about the traffic (e.g. one control goes to 1 server, the other goes to another) you could configure the process to use a Proxy Configuration Script (search for FindProxyForURL) to chain traffic bound for different servers to different proxies.
If you do set the proxy, you should use InternetSetOption rather than directly manipulating the registry.
(As a workaround, you COULD put FiddlerCore into your process, set your process to use FiddlerCore, and then have FiddlerCore send traffic from each control to a different upstream gateway, but that requires that you find some way to distinguish traffic from each control.)
Actually I think that writing the registry is the only way because WebBrowser
creates an instance of Internet Explorer, so you have to change IE settings modifying the registry.
If you don't want to change actual configuration you could store proxy address, modify it with yours and then restore it when the application closes.
精彩评论