【发布时间】:2014-02-20 19:51:27
【问题描述】:
我正在使用处理程序使用以下代码在浏览器窗口中获取和显示 PDF:
byte[] byt = RetrieveDocument(int.Parse(context.Request.Params["id"]), context.Request.Params["title"]);
string file = WriteDocumentFilePDF(byt);
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-length", byt.Length.ToString());
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=programdetails.pdf");
HttpContext.Current.Response.BinaryWrite(byt);
HttpContext.Current.Response.End();
函数 WriteDocumentFilePDF 成功地将 PDF 写入临时目录。我有上面的代码在不同的应用程序中正常工作。我错过了什么吗?
【问题讨论】: