當用戶請求下載文檔時,我使用HttpResponse.OutputStream.Write方法向PDF文件寫出HttpResponse。它適用於除Firefox之外的所有瀏覽器(3.5.8)。在Firefox中,它有時會顯示文件,有時會顯示實際的字節流。當它顯示一個字節流時,http響應永遠不會完成。我看到「傳輸數據」狀態,字節流以EOF結束。一段時間後,我得到'連接被重置'窗口。Firefox零星地顯示文件流而不是文檔
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
這裏是響應頭:
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
我相信mime類型設置正確。我正在下載PDF,Content-Type是application/pdf –