I have a console app built on .NET 4 that uses the HttpClient
library (obtained via NuGet) to retrieve data from a public API over the internet. The console app
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