0

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?

John Saunders
  • 157,405
  • 24
  • 229
  • 388
TheGateKeeper
  • 4,224
  • 17
  • 57
  • 96
  • possible duplicate of [How to create a simple proxy in C#?](http://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c) – mechanical_meat Mar 29 '12 at 20:07

2 Answers2

1

I reccomend you use an HttpListener and a HttpWebRequest. For more information look here.

Community
  • 1
  • 1
Omar
  • 14,695
  • 8
  • 40
  • 61
0

The WebBrowser control is exactly the same as Internet Explorer. They use the same proxy settings. Look up the WinINET API.

John Saunders
  • 157,405
  • 24
  • 229
  • 388