I have a really strange situation here: I wrote an application that, among other things, switches the connection proxy from one to another and vice versa. This is done by changing the value in the registry:
public void SetUpProxy(string proxy, bool enable)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
if (proxy != null)
key.SetValue("ProxyServer", proxy);
key.SetValue("ProxyEnable", enable ? 1 : 0);
key.Close();
}
When I ask to enable the proxy in my application, the first thing it does is connect to the ftp server, download the file, then activate the proxy server (the download will not work with the proxy server). Everything works fine - until I started Internet Explorer.
For example: if I run my application, let it turn on the proxy server, and then let it turn off the proxy server - everything works fine. But if I turn on the proxy server, then start IE , turn off the proxy and try turning it on again, it does not work - the application cannot connect to the ftp server, because somehow it uses the proxy server, although the value is in the registry 0!
I hope I managed to explain this correctly. My question is: why is this happening and how can I fix it?
: WebClient . , client.Proxy.GetProxy(myUri) Uri, , IE, " http://theUriFromIE".