好吧好吧,我設法避開我的問題是這樣的:
我創建報告,並將其保存到被每天刪除的臨時文件夾。
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/