I have a page, when the user clicks a button, a PDF is dynamically generated and offered for download.
This is the code that allows the user to download pdf:
// Omitted code that generates the pdf bytes response.ContentType = "application/octetstream"; response.AppendHeader("Content-Disposition", "attachment; filename=" + filename); response.BinaryWrite(pdfBytes); response.End();
On my machine and many others using a mixture of Chrome, IE 7/8 / 9b and Firefox, this works as expected; user clicks a button, pdf loads.
In some cases of IE7, our users report that they receive an error message:
"Internet Explorer cannot download Publish.aspx from thesite.com
Internet Explorer was unable to open this website. The requested site is either unavailable or not found. Please try again later. "
Publish.aspx is the page the button is located on, so this page is accessible. IE should download the PDF file.
Is there something that doesn't match the code above that might be causing this on certain machines? Or does it depend on the specific security / OS / browser settings?
EDIT:
These are the response headers from the violinist:
HTTP/1.1 200 OK Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Content-Type: application/octetstream Expires: -1 Server: Microsoft-IIS/7.5 Content-Disposition: attachment; filename=myPdf.pdf X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Fri, 12 Nov 2010 09:48:06 GMT Content-Length: 45772
source share