Once upon a time…
I was helping a customer with his web application, which was dynamically generating Excel workbooks, but he was running into a complication that was happening on his site but not others. On this particular site, every time he tried to download one of the workbooks, he got the following error message from Internet explorer:
Internet Explorer cannot download <page name>.aspx from <server>. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
Oh, goodness.
The plot thickens…
This message can occur if Internet Explorer attempts to open a downloaded file in Office, but is unable to save the file to the local cache directory. The most common reasons for the behavior are:
- The server is using SSL and Internet Explorer is not set to save encrypted file to disk. This property can be checked by going to Options in IE > Advanced > Security > “Do not save encrypted pages/files to disk”.
- The server is using SSL and certain HTTP headers are added to the response which prevent the files from caching [1]:
- Pragma: no-cache
- Cache-control: no-cache,max-age=0,must-revalidate
[1] Some firewalls and security programs will add these headers automatically. (How terribly kind of them..)
The end is in sight!
The customer was using SSL and the Response.CacheControl = "no-cache" for security reasons on that particular site.
To get around the issue, he added <%@ OutputCache Duration="60" VaryByParam="none" %> to the page that was generating the report and the issue disappeared.
For all the glorious details about the error message: check it out at Microsoft Support.
Share the post "Downloading Excel file: Internet Explorer cannot download ‘page’.aspx"