how to set WebBrowser proxy

2019-02-11 10:52发布

I am making a multi-threaded application. Each thread has its own WebBrowser control. I want to know how to set a different proxy for each WebBrowser. A custom WebBrowser that supports a proxy per instance will be a good solution to me as well.

4条回答
Deceive 欺骗
2楼-- · 2019-02-11 11:30

Since the WebBrowser is just an instance of the IE, it is impossible to set the Proxy for it. (Unless you tweak the registry, but it it's not individually)

查看更多
爷的心禁止访问
3楼-- · 2019-02-11 11:32

Maybe another approach would be in order.

You could spawn a WebRequest in the background threads and set a different proxy for each one. After you receive the data, then you can easily load it in a WebBrowser to play with it.

查看更多
爷的心禁止访问
4楼-- · 2019-02-11 11:33

Using unmanaged code it can be achieved, it may help:

http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx

查看更多
女痞
5楼-- · 2019-02-11 11:45

As maor said, you won't be able to do a proxy per browser setup with WebBrowser. Instead, if you have control over the proxy, you might want to see what options it has for identifying a session (request/response). You might be able to, from the one proxy, tell which requests are probably coming from which WebBrowser controls depending on URLs and headers, etc.

查看更多
登录 后发表回答