title: Asp.Net Core: Download SSRS reports in PDF format on client browser
body: <p>I have one SSRS report URL which if I enter that URL in the browser then it shows the SSRS report with Print and Save option like:</p>
  
  <p><a href="https://i.stack.imgur.com/6uE9N.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6uE9N.png" alt="enter image description here"></a></p>
  
  <p>Which works fine on the browser.</p>
  
  <p>What I want, there is one button on <code>.cshtml</code> page so by clicking on that button I need to download the report on client browser.</p>
  
  <p>URL: <a href="http://xyz/ReportS/report/UAT/SampleReport_V1?Srno=X123" rel="noreferrer">http://xyz/ReportS/report/UAT/SampleReport_V1?Srno=X123</a></p>
  
  <p>What I tried:</p>
  
  <p>by setting <code>&amp;rs:Format=PDF</code> and made a HTTP Request from Asp.Net Core Application but it generated PDF but in corrupt format.</p>
  
  <p>Code:</p>
  
  <pre><code>public void Download_SSRSInPDF()
  {
      string URL = "http://xyz/ReportS/report/UAT/SampleReport_V1";
      string Command = "Render";
      string Format = "PDF";
      URL = URL + "?SrNo=X123&amp;rs:Command=" + Command + "&amp;rs:Format=" + Format;
      System.Net.HttpWebRequest Req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(URL);
  
      Req.Credentials = System.Net.CredentialCache.DefaultCredentials;
      Req.Method = "GET";
      string path = @"E:\New folder\Test.pdf";
      System.Net.WebResponse objResponse = Req.GetResponse();
      System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
      System.IO.Stream stream = objResponse.GetResponseStream();
      byte[] buf = new byte[1024];
      int len = stream.Read(buf, 0, 1024);
  
      while (len &gt; 0)
      {
          fs.Write(buf, 0, len);
          len = stream.Read(buf, 0, 1024);
      }
      stream.Close();
      fs.Close();
  }
  </code></pre>
  
  <p>How to do it in Asp.Net Core?</p>
  
  <p><strong>EDIT:</strong>:</p>
  
  <p>I have that asmx url of my report:</p>
  
  <pre><code>http://server-name/ReportServer/reportexecution2005.asmx
  </code></pre>
  
  <p>But unable to proceed with this, can someone points me towards documentation?</p>