When user requests to download a document, I'm writing out a PDF file to HttpResponse using HttpResponse.OutputStream.Write method. It works in every browser except Firefox(3.5.8). In Firefox it sometimes displays the file and sometimes it displays the actual byte stream. When it displays a byte stream, http response is never finished. I see 'transferring data' status and the byte stream ends with EOF. After some time, I get 'connection was reset' window.
alt text http://img31.imageshack.us/img31/7907/displaybytes.png alt text http://img193.imageshack.us/img193/7246/displayendofstream.png alt text http://img211.imageshack.us/img211/1774/timeout.png
Here is response header:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 103185
Content-Type: application/pdf
Expires: -1
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
Content-Description: stuff.pdf
Content-Disposition: inline;filename="stuff.pdf"
X-Powered-By: ASP.NET
Date: Mon, 22 Feb 2010 16:15:38 GMT
It might have also to do with the action assigned to the mime type of the document. For instance in FF this actions can be set.
But of course you also need to make sure the server is streaming the correct mime type.
I think the issue is most likely in Firefox or with the Acrobat plugin.
Whenever something works sometimes but not others, you have to pay real close attention to the differences. The issue is always in the differences.
In your case, you may never know why, because the differences may be in the browser or the plugin. Your header looks like it is supposed to look. It works in all other browsers. Based on your header, this is the way it is supposed to work in this browser, too.
I would pose this to Mozilla and see what they have to say.
As a potential workaround, You could try changing your Content-Disposition to 'attachment' when your user's browser is FF. This would cause the "Open or Save" dialog box to appear. Then your user can still click "open" to view it in the page.
Content-Disposition: attachment; filename=stuff.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With