Ang*_*ker 5 pdf asp.net internet-explorer .net-3.5
我的应用程序将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();
}
Run Code Online (Sandbox Code Playgroud)
在客户端,当用户按下按钮时,onClick处理程序中会发生以下情况:
onclick ="window.open('RptHandler.ashx?RptType = CaseInfo','Report','top = 10,left = 10,width = 1000,height = 750')
我错过了一些非常基本的东西吗 为什么它适用于所有浏览器而不是IE?
事实证明,以下语句导致IE无法显示PDF:
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Run Code Online (Sandbox Code Playgroud)
不知道为什么。
| 归档时间: |
|
| 查看次数: |
2011 次 |
| 最近记录: |