Ie7/8: Pdf File Won't Download With Http Get
Solution 1:
Can you try this-
Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader(
"Content-Disposition",
string.Format("attachment; filename={0}",filename)
);
// stream pdf bytes to the browser
Response.OutputStream.Write(estatement.Document, 0, estatement.Document.Length);
Response.End();
Solution 2:
Here is a post on stackoverflow that I had which sounds like the same problem.
IE8 and lower cant handle the Cache-control header and causes static content such as PDF's to not get downloaded.
Solution 3:
Two things:
1) Clear all of your headers prior to creating your response in your handler. This solved an issue for me cause by Microsoft Security Bulletin MS11-100 where the Cache-Control header was getting set to no-cache="Set-Cookie"
(see this blog post for more info) :
// snip...if (estatement.Document != null)
{
context.Response.ClearHeaders();
context.Response.Clear();
context.Response.ContentType = "Application/pdf";
// snip...
2) I'm not sure if this is actually causing any issues, but rather than creating an iframe each time a user downloads a PDF, why not just set the window.location property? This way you're not adding "throw-away" iframes to the document, and the behavior should still be the same:
functionEStatementDownload(fileid) {
window.location = "EStatementFile.ashx?fileid=" + fileid;
}
Post a Comment for "Ie7/8: Pdf File Won't Download With Http Get"