IE : Unable to download * from *. Unable to open this Internet site. The requested site is either unavailable or cannot be found
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 wo开发者_如何学Gorks 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.
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
.
Based on the KB article David offered here (Internet Explorer file downloads over SSL do not work with the cache control headers), we changed our outgoing headers away from Cache-Control: no-cache
to Cache-Control: private
. This seems to have resolved the IE8 problem without affecting other browsers. Beware of using Cache-Control: no-store
as well.
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.
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");
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
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!!
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.
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();
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.
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.
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.
We had this same issue with IE8 using an MVC controller tagged with NoCache
. This sets Response.Cache.SetNoStore
which breaks file downloads in IE.
To resolve - you can reset the Http Cache Policy via reflection.
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.
精彩评论