//
ProxyEnable == 0 means the proxy is on
// ProxyEnable == 1 means the proxy is off
// ProxyEnable == 1 means the proxy is off
string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet
Settings";
string serverName = ConfigurationManager.AppSettings["proxyAddress"];
int port = Convert.ToInt32(ConfigurationManager.AppSettings["proxyPort"]);
string proxyy = serverName + ":" + port;
RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);
RegKey.SetValue("ProxyServer",
proxyy);
RegKey.SetValue("ProxyEnable", 1);
proxy = new WebProxy(proxyy,
true);;
proxy.Credentials = CredentialCache.DefaultCredentials;
proxy.BypassProxyOnLocal = true;
what is ConfigurationManager ?
ReplyDeleteThe ConfigurationManager class enables you to access machine, application, and user configuration information. This class replaces the ConfigurationSettings class
ReplyDelete