title: .NET WebClient sends request without authentication first
body: <p>I'm building a web service with Asp.net web api, and I have to fetch an image from an AXIS IP Camera. The camera, however, uses Digest authentication. So my C# code looks something like this:</p>
  
  <pre><code>            WebClient webClient = new WebClient();
              webClient.UseDefaultCredentials = true;
              webClient.Credentials = new NetworkCredential("***", "***");
              byte[] imageStream = webClient.DownloadData("http://192.168.0.90/axis-cgi/jpg/image.cgi");
  </code></pre>
  
  <p>This all works, but when looking at Fiddler, I found that the client sends one request without authentication, and a 401 error returns. After that it sends the one with digest security.</p>
  
  <p>I've found a solution with manual credentials injection here:</p>
  
  <p><a href="http://kristofmattei.be/2013/02/20/webclient-not-sending-credentials-heres-why/" rel="noreferrer">http://kristofmattei.be/2013/02/20/webclient-not-sending-credentials-heres-why/</a></p>
  
  <p>But this looks wrong. It uses basic authentication, which I don't want really and looks a bit unprofessional.</p>
  
  <p>Is there any way to send the signed request immediately or is this how that works because I'm noticing that the camera is returning the nonce in the first request?</p>