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?
Here is the Razor code from the View:
<script>
    $(document).ready(function () {
        var url = $('#reportUrl').val();
        $("#iframe1").attr("src", url);
    });
</script>
<input type="hidden" id="reportUrl" value="@Url.Action("ContactListPDF2","Reports")" />
<div class="block-head">
    <div class="item-content">
        <iframe id="iframe1" style="border: 1px solid black; height: 500px; width: 100%">
        </iframe>
    </div>
</div>
And here is the appropriate method from my controller:
public ActionResult ContactListPDF2()
{
    byte[] reportData = ReportsModel.GetContactListPDF();
    return new FileContentResult(reportData, "application/pdf");
}
I know I am missing something simple and obvious, but for the life of mean I can determine what it is.
 
     
    