title: C# using WebClient to download chunked encoded content
body: <p>I wrote a client application that is suppose to download a file from a web server, very simple:</p>
  
  <pre><code>using (WebClient webClient = new WebClient())
  {
      webClient.DownloadFile("http://localhost/audiotest/audio.wav", 
                             @"C:\audio.wav");
  }
  </code></pre>
  
  <p>The web site (where audio file located: <a href="http://localhost/audiotest/audio.wav" rel="nofollow noreferrer">http://localhost/audiotest/audio.wav</a>) has header Transfer-Encoding: chunked</p>
  
  <p>When I run the program, I get following error:</p>
  
  <blockquote>
    <p>The server committed a protocol violation. Section=ResponseBody
    Detail=Response chunk format is invalid</p>
  </blockquote>
  
  <p>How can I download the file when server contains Transfer-Encoding: chunked header?</p>