标签归档:proxy for the WebBrowser

How To: Set the proxy for the WebBrowser control in .NET

Source:https://blogs.msdn.microsoft.com/jpsanders/2011/04/26/how-to-set-the-proxy-for-the-webbrowser-control-in-net/

I see some horrible solutions for this out on the web.  Most involve setting the proxy for the entire machine and then toggling it back off.  Here is a class that will allow you to set it ONLY FOR THE PROCESS that the control is hosted in.  You could call it like this:

WinInetInterop.SetConnectionProxy(“localhost:8888”);

and then restore it to the default set in IE with this call:

// read the default settings for IE and restore these as the proxy
WinInetInterop.RestoreSystemProxy();
Let me know if you thought this was useful! 继续阅读