SLaks/Ref12

Proxy authentication

Closed this issue · 0 comments

Hello,
I have a problem with a proxy which requires authentication. HttpClientHander.UseDefaultCredentials doesn't set the credentials to the proxy but only to the request. It seems that Proxy has to be explicitly set if authentication is required. If Proxy is set to null and UseProxy to true (which is default) the default proxy with no credentials is used. The following code work for me:

handler.Proxy = WebRequest.GetSystemWebProxy();
if (handler.Proxy != null)
{
handler.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
}

It would be nice if this could be implemented in any way.