I have an issue with my website and IE. I have a file Document.ashx that becomes a document from my database depending on the parameter passed in the query string.

The file works if:

  • You're on my website and click a download link.
  • You access anything on my site and paste the URL into the address bar and access it.
  • You've already access the document link once before, even if it did error.

It doesn't work if:

  • You've not accessed my site with the current IE open and paste the link in the address bar. It displays the following error:

Windows Internet Explorer

Unable to download Document.ashx from MyHostName.

Unable to open this Internet site.

The requested site is either unavailable or cannot be found.

Please try again later.

Does anyone have a clue what would cause this. Naturally it works fine in Firefox.

I've gotten several people in my office to try it with IE and they all get the same issue. They all say it works in Firefox.

dfeuer's user avatar

dfeuer

47.7k 5 gold badges 61 silver badges 167 bronze badges

asked Aug 5, 2010 at 13:55

Smartie's user avatar

5

Just like rymo said set Cache-Control: private, If your response header happen to have the Pragma :no-cache, you also have to change it to Pragma: token .

John Conde's user avatar

John Conde

215k 98 gold badges 447 silver badges 489 bronze badges

answered Dec 6, 2011 at 17:34

Eileen's user avatar

4

It turns out IE8 can be made to accept fully-disabled caching, but it is very picky about the exact order of the headers. So instead of falling back to private (which allows certain caching and might not fit with your security needs) use:

                  Cache-Control: no-store, no-cache, must-revalidate                                  

When specified in that exact order - first no-store THEN no-cache - IE8 will allow the file download without error. Be sure also that the Pragma header is NOT set.

answered Oct 2, 2013 at 19:39

rymo's user avatar

4

This issue occurs in IE8, and possibly earlier versions - but is resolved in IE9+. It is related downloading documents over SSL.

To resolve the issue in my application, I had to add the following two headers to the download (written in PHP):

                  header("Cache-Control: private"); header("Pragma: cache");                                  

answered May 7, 2013 at 21:16

Dan's user avatar

2

It sounds like I problem I came accross with IE 8 only. When I was tracking down a solution I came across 2 solutions. One of them should correct this issue.

Just to let you know it is a fix on the client machine as it is how IE coded that causes the issue.

Fixes: http://support.microsoft.com/kb/815313 http://support.microsoft.com/kb/323308

rymo's user avatar

rymo

3,169 2 gold badges 33 silver badges 39 bronze badges

answered Jun 1, 2011 at 22:40

David's user avatar

What's all the fuss about ? The issue is due to immediate cache expiration or no-cache.

Do the following to fix the issue:

Goto server system -> Run Inetmgr -> RightClick and properties on the folder(e.g images) -> httpHeaders -> Now Either uncheck Enable content expiration, or check Expire after and give 1 min.

This is for IIS 5.

There will be similar setting for IIS 6/7.

Happy programming!!

answered Nov 22, 2012 at 6:35

Dhananjay pal's user avatar

1

I had the same problem and was frustrated by trying all above methods of correcting it. Obviously I did not want a solution done at client machine so all I did was just delete the "Pragma" parameter from the header and it started working nicely. PROBLEM SOLVED.

answered Apr 27, 2012 at 8:45

datta bhor's user avatar

if you using asp.net. remove the code with sets cache

Comment the following

                                  Response.Clear();    Response.Buffer = true;    Response.Charset = "";    **//Response.Cache.SetCacheability(HttpCacheability.NoCache);**    Response.ContentType = contentType;    Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);    Response.BinaryWrite(bytes);    Response.Flush();    Response.End();                              

answered May 12, 2014 at 12:14

Sheryar Nizar's user avatar

We had this same problem embedded in our ClickOnce deployment of www.Qiqqa.com. I suspect it has to do with the "MIME Type sniffing" that IE does when it gets an application/octet-stream - I guess to protect the user from malicious stuff.

Anyway, to solve the problem, we changed the mime type of our .deploy files to be text/plain - obviously not ideal, but at the same time, I don't know a scenario where we might have a .deploy file on our server that a user would browse to outside ClickOnce.

Problem solved.

ib.'s user avatar

ib.

26.8k 10 gold badges 77 silver badges 99 bronze badges

answered Oct 20, 2010 at 19:43

Jimme's user avatar

dynamic create Iframe ,set the src to the download page loaction , append to the body.

function downloadInIFrame(fileId) { var url = "download.aspx?fileId=" + fileId; var iframe = document.createElement("iframe"); iframe.src = url; iframe.style.display = "none"; document.body.appendChild(iframe); }

those code works well for me.

answered Jan 10, 2013 at 14:59

phil hong's user avatar

If you do 'Save target As...' or Open in new tab, it works fine. But still giving error in IE8. I have same implementation... as creating the div (display:none) having iframe, and appending it to body and set src to frame whose content type is application/binary.

answered Oct 11, 2013 at 15:59

Sandip Bhoi's user avatar

This issue is caused by a browser setting in Internet Explorer. In Internet Explorer go to Tools > options > Advanced options. In the section marked Security, locate and clear the Do not save encrypted pages to disk.

NewUser's user avatar

NewUser

3,649 8 gold badges 54 silver badges 77 bronze badges

answered Aug 13, 2012 at 5:15

Arun's user avatar