Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox 33 doesn't display a pdf file when using the response object

more options

Firefox 33.0.2 does not display pdf files when using the code below from an asp.net program, which works for previous versions of Firefox, and also works with IE. I'm using the built-in pdf viewer. All of my plugins are disabled.

           Dim strPDF As String
           strPDF = Session("filname")   'pdf filename
           Response.Clear()
           Response.ClearHeaders()
           Response.Buffer = True
           Response.ContentType = "application/pdf"
           Response.CacheControl = "Private"
           Response.AddHeader("Pragma", "no-cache")
           Response.AddHeader("Expires", "0")
           Response.AddHeader("Cache-Control", "no-store, no-cache, must-revalidate")
           Response.AddHeader("Content-Disposition", "inline; filename=" + strPDF)  
           Response.WriteFile(strPDF)
           Response.Flush()
           Response.Close()
           Response.Clear()
           Response.End()
           Session("filname") = ""
Firefox 33.0.2 does not display pdf files when using the code below from an asp.net program, which works for previous versions of Firefox, and also works with IE. I'm using the built-in pdf viewer. All of my plugins are disabled. Dim strPDF As String strPDF = Session("filname") 'pdf filename Response.Clear() Response.ClearHeaders() Response.Buffer = True Response.ContentType = "application/pdf" Response.CacheControl = "Private" Response.AddHeader("Pragma", "no-cache") Response.AddHeader("Expires", "0") Response.AddHeader("Cache-Control", "no-store, no-cache, must-revalidate") Response.AddHeader("Content-Disposition", "inline; filename=" + strPDF) Response.WriteFile(strPDF) Response.Flush() Response.Close() Response.Clear() Response.End() Session("filname") = ""

由cm0117于修改

被采纳的解决方案

What is the result of this code that Firefox receives via the HTTP response headers if you check that with the Live Http Headers extension?

定位到答案原位置 👍 0

所有回复 (5)

more options

选择的解决方案

What is the result of this code that Firefox receives via the HTTP response headers if you check that with the Live Http Headers extension?

more options

Below are the results from Live Http Headers. Thanks for your assistance.

HTTP/1.1 200 OK Date: Wed, 05 Nov 2014 15:52:32 GMT Server: Microsoft-IIS/6.0 MicrosoftOfficeWebServer: 5.0_Pub X-Powered-By: ASP.NET X-AspNet-Version: 4.0.30319 Pragma: no-cache Content-Disposition: inline; filename=E:\CustomerData\testfil.pdf Transfer-Encoding: chunked Cache-Control: private Content-Type: application/pdf

more options

Thanks cor-el. You pointed me in the right direction. It appears to me that a reported Firefox 33 bug with the handling of compression (Transfer-Encoding: chunked) is the culprit (https://support.mozilla.org/en-US/questions/1026743). I was able to find a work-around by specifying the file size and buffering. Below is my code, with some code from http://www.codeproject.com/Questions/440054/How-to-Open-any-file-in-new-browser-tab-using-ASP.

           Dim strPDF As String
           strPDF = Session("filname")   'pdf filename
           Dim User As New WebClient()
           Dim FileBuffer As [Byte]() = User.DownloadData(strPDF)
           If Not (FileBuffer Is Nothing) Then
               Response.Clear()
               Response.ClearHeaders()
               Response.CacheControl = "Private"
               Response.AddHeader("Pragma", "no-cache")
               Response.AddHeader("Expires", "0")
               Response.AddHeader("Cache-Control", "no-store, no-cache, must-revalidate")
               Response.ContentType = "application/pdf"
               Response.AddHeader("content-length", FileBuffer.Length.ToString())
               Response.BinaryWrite(FileBuffer)
               Response.Flush()
               Response.Close()
               Response.Clear()
               Response.End()
           End If
           Session("filname") = ""
more options

My problem is different. After updating I tried to display the Banks statement which starts the Adobe PDF reader and then never displays the file. Just a little circle going round and round. I can save the file and double click it to display the file in reader but it will not display in Firefox. Works in IE also.

more options

Hi bmazak, you're right that it's a different problem. Would you mind starting a new question here: https://support.mozilla.org/questions/new/desktop/fix-problems - scroll down past the suggested articles to continue with entering your question.

Also, if you haven't tried using a different viewer, you could check out this article: View PDF files using Firefox’s built-in viewer.