Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF download fails showing message "Couldn't be downloaded" only in IE11

I use ASP.NET with web forms, something that should be really easy is driving me crazy, similar questions have been asked but none of them helped me, IE refuses to download my files.

Things to notice:

  • I'm testing locally
  • It works in Firefox and Chrome but not IE11
  • IE changes file name to page's name (for example it tries to save default_aspx instead of myfile.pdf) File name changedenter image description here

This is my code:

Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "Application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.BinaryWrite(buffer);
Response.End();

These are the headers I got from IE:

Key Value

Response HTTP/1.1 200 OK

Cache-Control private

Content-Type Application/PDF

Server Microsoft-IIS/7.5

Content-Disposition attachment; filename=myfile.pdf

X-AspNet-Version 4.0.30319

X-Powered-By ASP.NET

Date Fri, 10 Apr 2015 22:44:40 GMT

Content-Length 691892

UPDATE

It seems like this is a server configuration issue because the same code will work fine in my production server but not in my development server. So my client won't complain about this, anyway I want to fix it in my development environment, as soon as I have time I'll investigate a little more, if I find a solution I'll post it here.

like image 346
marcos.borunda Avatar asked Apr 10 '15 23:04

marcos.borunda


People also ask

How to download files in Internet Explorer?

Open Internet Explorer, select the Tools button, and then select View downloads. In the View Downloads dialog box, select Options in the lower-left. Choose a different default download location by selecting Browse and then selecting OK when you're done.

Why can't I download a file from a website?

This error means you don't have permission to download the file. To fix the error, contact the website or server owner, or try to find the file on a different site. This error means you don't have permission to download this file from the server. To fix, go to the website where the file is hosted.


2 Answers

We had a similar issue in ie8 the problem is that the file is searched in the cache and is not found. To test this please set Cache-Control : no-cache in your response object.

like image 63
Mihai Avatar answered Sep 23 '22 20:09

Mihai


This is not the exact answer but hope if it can open some ways to find the exact one.

While googling I found this may be due to a security update release by Microsoft for IE.

Microsoft released a security update for IE11 on 8 Jul 14 which has a bug affecting the download.

And here is the Microsoft Connect Link that mention this under active status.

Please share exact solution once you find it.

Cheers!!

like image 21
Shri Avatar answered Sep 24 '22 20:09

Shri