【发布时间】:2010-10-25 00:43:51
【问题描述】:
我的应用程序将 PDF 文件推送到弹出式(例如,没有菜单/工具栏)浏览器窗口(以响应用户单击按钮)。这适用于除 IE7 之外的所有浏览器。在 IE7 中,我得到的只是一个空白窗口。
这是推出 PDF 的服务器端代码:
private void StreamPDFReport(string ReportPath, HttpContext context)
{
context.Response.Buffer = false;
context.Response.Clear();
context.Response.ClearContent();
context.Response.ClearHeaders();
// Set the appropriate ContentType.
context.Response.ContentType = "application/pdf";
context.Response.AddHeader("Content-Disposition", "inline; filename=Report.pdf");
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
// Write the file directly to the HTTP content output stream.
context.Response.WriteFile(ReportPath);
HttpContext.Current.ApplicationInstance.CompleteRequest();
//context.Response.End();
}
在客户端,当用户按下按钮时,onClick 处理程序中会发生以下情况:
onclick="window.open('RptHandler.ashx?RptType=CaseInfo', 'Report', 'top=10,left=10,width=1000,height=750')
我错过了一些非常基本的东西吗?为什么它可以在所有浏览器中运行,但不能在 IE 中运行?
【问题讨论】:
标签: asp.net internet-explorer .net-3.5 pdf