Reputation: 4530
I have looked everywhere for an answer and all I found was confusing-incomplete bits.
The best way I found was to modify the registry like so:
string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
string serverName = "";//your proxy server name;
string port = ""; //your proxy port;
string proxy = serverName + ":" + port;
RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);
RegKey.SetValue("ProxyServer", proxy);
RegKey.SetValue("ProxyEnable", 1);
This works, but I need to also set the username and the password for the proxy.
I found that you can use the WebProxy class as this takes the credentials, but it doesn't work with WebBrowser.
So the other alternative would be to create an application-wide proxy where all http requests are routed thru it.
Anyone has any help on this?
Upvotes: 0
Views: 1382
Reputation: 161773
The WebBrowser control is exactly the same as Internet Explorer. They use the same proxy settings. Look up the WinINET API.
Upvotes: 0
Reputation: 16623
I reccomend you use an HttpListener and a HttpWebRequest. For more information look here.
Upvotes: 1