【发布时间】:2016-11-16 21:48:18
【问题描述】:
【问题讨论】:
-
我认为是内容类型错误相关..您需要使用application/pdf返回有效的内容类型。
-
我不确定我是否理解您使用 application/pdf 的意思,因为我已经指定了文件类型。一定有我在这里遗漏的东西或与 Chrome 有关的东西......
-
好的,你这样指定响应的内容类型:Response.ContentType = "application/pdf";
-
是的,我已经在下面看到了。 if (strExt[strExt.Length-1] == "pdf") { Response.ContentType = "application/pdf"; } Response.AddHeader("Content-Disposition", "inline;filename=" + objectreader["document"]);响应缓冲区=真; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(pdfbytes);
-
你需要把这个:Response.ContentType = "Application/pdf"; Response.TransmitFile(pathtofile);