-
Get proxy info
Hello,
C# 2008 SP1
I am using the code to detect if a proxy has been set under "Internet Options". If there is a proxy then I will set this in my webclient.
So I am just checking if the address of the proxy exists. If there is not, then there is no proxy to set in the webclient.
Is this the correct way to do this:
Many thanks for any advice,
Code:
WebProxy proxy = WebProxy.GetDefaultProxy();
if (proxy.Address.ToString() != string.Empty)
{
Console.WriteLine("Proxy URL: " + proxy.Address.ToString());
wc.Proxy = proxy;
}
-
Re: Get proxy info
I'm not familiar with that WebProxy class you are using but just thought you might find this information useful - the proxy settings that you set in Internet Options are stored in the following location in the registry:
HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings