好吧好吧,我设法避开我的问题是这样的:
我创建报告,并将其保存到被每天删除的临时文件夹。
System.IO.File.WriteAllBytes(Server.MapPath("/TempReports/report.pdf"), renderedBytes);
我的控制器操作只是返回了一个链接到呈现的报告。
JavaScript的:
function GenerateReport() {
$.ajax({
type: "POST",
url: "/Reporting/ReportAction",
data: { param1: "", param2: "" },
success: function (data) {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
//set of functions specific to IE
var success = new PDFObject({ url: data }).embed("reportGenIe");
$("#reportGenIe").attr('hidden', false);
}
else {
//Normal browsers
var success = new PDFObject({ url: data }).embed("reportGen");
}
},
error: function() {
alert("Unable to generate the report.");
}
});
对于IE我使用的iFrame和其他浏览器我使用的物体
<div role="content" style="padding-bottom:20px; height:650px !important">
<iframe id="reportGenIe" hidden="hidden"></iframe>
<object id="reportGen"></object>
</div>
这包括围绕IE得到拒绝动态地显示一个pdf我。
我使用了PDFObject js库,它似乎已经完成了这个技巧。 http://pdfobject.com/