title: How to Make a link to download PDF file?
body: <p>I have created a link that download the PDF file When click on the Link.</p>
  
  <p>Here is my .cshtml:
  
  </p>
  
  <pre><code>&lt;h1&gt;Hello Shuainan&lt;/h1&gt;
  &lt;a href="/Account/PdfDownload"&gt;download&lt;/a&gt;
  
  
  &lt;input type="button" value="Download" onClick="download('test.pdf')" /&gt;
  
  &lt;script&gt;
      function download(file) {
          window.location = file;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>and the download function is :</p>
  
  <pre><code>public void PdfDownload(string path, string fileName)
  {
        var myPDF = System.IO.File.ReadAllBytes(@"C:\Program Files\wkhtmltopdf\bin\myPDF.pdf");
  
        Response.ContentType = "Application/pdf";
  
        Response.Headers.Add("Content-Disposition", "attachment; filename=testPDF.pdf");
        Response.Body.Write(myPDF, 0, 2048);
  }
  </code></pre>
  
  <p>But then I can't load the PDF file when the download is finished.</p>