title: Downloading a PDF file from a url location results in a HTML file
body: <p>I'm trying to download a PDF file from the net. The downloaded file is an HTML file (cannot be opened with Adobe Reader). The download is done with result 200.</p>
  <pre><code> string tempFile = System.IO.Path.GetTempFileName();
   tempFile = System.IO.Path.ChangeExtension(tempFile, &quot;pdf&quot;);
     
   HttpResponseMessage msg;
   using (HttpClient client = new HttpClient())
   {
   msg = await client.GetAsync($&quot;https://www.anaf.ro/StareD112/ObtineRecipisa?numefisier=217776607.pdf&quot;);
  
              if (msg.IsSuccessStatusCode)
              {
                  using (var file = File.Create(tempFile))
                  {
                      var contentStream = await msg.Content.ReadAsStreamAsync(); 
                      await contentStream.CopyToAsync(file);
                      await file.FlushAsync();
                  }
              }
          }
  </code></pre>
  <p>The downloaded file has the content:</p>
  <pre><code>&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot;/&gt;&lt;meta http-equiv=&quot;Expires&quot; content=&quot;-1&quot;/&gt;&lt;meta http-equiv=&quot;CacheControl&quot; content=&quot;no-cache&quot;/&gt;&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;/&gt;&lt;link rel=&quot;shortcut icon&quot; href=&quot;data:;base64,iVBORw0KGgo=&quot;/&gt;&lt;script&gt;(function(){window[&quot;bobcmn&quot;] = &quot;111111101...})();&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;/TSPD/08b919fd7aab2000e3f4522c0108677748c289d7a5e2904fcfef59fb022a19a5fd44f0a0664ad54a?type=10&quot;&gt;&lt;/script&gt;&lt;noscript&gt;Please enable JavaScript to view the page content.&lt;br/&gt;Your support ID is: 10865965003120525066.&lt;/noscript&gt;
  </code></pre>
  
  
  <p>Can you tell me what I'm not doing right?</p>