How to authenticate against a proxy when using the HttpClient class?

I managed to solve my problem very simply through proxy configuration in app.config.

<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
        <proxy usesystemdefault="True" />
    </defaultProxy>
</system.net>

http://msdn.microsoft.com/en-us/library/dkwyc043.aspx


If you wanted to do the same programmatically you could use the following:

WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;

(These objects are from the `System.Net' namespace).

Some more info from MSDN: http://msdn.microsoft.com/en-us/library/system.net.webproxy.getdefaultproxy.aspx