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;
        }