Using Proxy with web browser control

霸气de小男生 提交于 2019-12-01 13:34:38

问题


is it possible to use two web browser controls with different proxies without writing the registry.

or there might be any solution ?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/5203847/using-proxy-with-web-browser-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!