I have a situation where a user running my .NET application may be behind a proxy.
I have found that using
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials
at the beginning of the program always allows requests to work, whether or not a proxy is specified in the operating system Local Area Network (LAN) Settings dialog for example.
Without this line, when behind a proxy I get a 407 Proxy Authentication Required when making a request.
Is there any downside to always executing this line in my program? In most cases users do not go through a proxy, so is there significant additional overhead for example, either in code or over the wire, or any other disadvantages in using this when a proxy isn't present?