I am making a multi-threaded applic开发者_Go百科ation. 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.
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.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)
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.
Using unmanaged code it can be achieved, it may help:
http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx
精彩评论