title: Load Generated PDF Data into IFRAME on ASP.NET MVC
body: <p>I have an ASP.NET website that generates a report as a PDF. I want to load that PDF into and IFRAME on my View. But when I try, it always prompts me to download the PDF. I have tried using the File() method, returning a new FileContectResult(), and even just using Response.BinaryWrite() but nothing seems to do the trick. Anyone have any good advice? </p>
  
  <p>Here is the Razor code from the View:</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function () {
          var url = $('#reportUrl').val();
          $("#iframe1").attr("src", url);
      });
  &lt;/script&gt;
  &lt;input type="hidden" id="reportUrl" value="@Url.Action("ContactListPDF2","Reports")" /&gt;
  &lt;div class="block-head"&gt;
      &lt;div class="item-content"&gt;
          &lt;iframe id="iframe1" style="border: 1px solid black; height: 500px; width: 100%"&gt;
  
          &lt;/iframe&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And here is the appropriate method from my controller:</p>
  
  <pre><code>public ActionResult ContactListPDF2()
  {
      byte[] reportData = ReportsModel.GetContactListPDF();
      return new FileContentResult(reportData, "application/pdf");
  }
  </code></pre>
  
  <p>I know I am missing something simple and obvious, but for the life of mean I can determine what it is. </p>