Firefox 33 doesn't display a pdf file when using the response object
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") = ""
Wót cm0117
Wubrane rozwězanje
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?
Toś to wótegrono w konteksće cytaś 👍 0Wšykne wótegrona (5)
Wubrane rozwězanje
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?
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
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") = ""
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.
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.