I am using HttpClient
to post an HttpRequest. The HttpClient
constructor accepts an HttpClientHandler
, which accepts an instance of CredentialCache
as the Credentials
property. A CredentialCache
should work with digest authentication.
The code should look like this:
var credCache = new CredentialCache(); credCache.Add(new Uri("http://.com/"),"Digest", new NetworkCredential(UserName,SecurelyStoredPassword,Domain)); var httpClient = new HttpClient( new HttpClientHandler { Credentials = credCache}); var answer = httpClient.GetAsync(new Uri("http://request.Uri"));
source share