Results 1 to 2 of 2

Thread: Get proxy info

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

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

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    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
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width