senzacionale
senzacionale

Reputation: 20936

programatically change proxy address on win 7

In Windows 7 I try programatically enable proxy for chrome with

RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", "IP:8080");

but now nothing works. I can not go on Internet anymore. How can reset values that Internet will start working again?

And where to get valid proxy urls?

Upvotes: 0

Views: 250

Answers (1)

Rikki
Rikki

Reputation: 646

Just disable the proxy and it should be fine.

string keyName = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true))
{
    if (key != null)
    {
        key.SetValue("ProxyEnable", 0);
    }
}

Upvotes: 1

Related Questions