"Internet Explorer cannot download <filename>" in Report Viewer controls


This week, I spent a fair amount of time dealing with a customer who had issues opening up SSRS reports exported into Word, Excel, and PDF. They used both the webform Report Viewer control and a custom control which added a content disposition header for the document type in question to the response and then wrote it out to the browser (see http://support.microsoft.com/default.aspx?scid=KB;EN-US;q306654&ID=KB;EN-US;q306654&lex for more details).


 


While using the Report Viewer, this error got thrown:


 


Internet Explorer cannot download … from SomeSite


Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.


 


When in their custom control, we’d see an error like this (from the app which should have opened the document: Word, Excel, whatever):


 


The file could not be found. Try one or more of the following:



  • Check the spelling of the name of the document
  • Try a different file name

(C:\…\TempFolderName\DocName.doc)


 


The customer was also using a third party ISAPI filter to implement security on IIS.


 


Long story short, we were running into the behavior described in the following article:


 


http://support.microsoft.com/default.aspx?scid=kb;en-us;316431


 


Our problem was actually masked by a number of factors. It turns out, we had two things going on:


 



  • Even though SSL was not configured on IIS, the customer had an ISAPI filter installed which used SSL under the covers to do encryption
  • The ISAPI also automatically added the CacheControl: no-cache header to the response (You can use Fiddler from www.fiddlertool.com/ to check the headers yourself)

 


…and as the article above states, if one uses SSL and the no-cache header gets sent down, we will NOT cache the files in question…So we were pretty much deleting the office docs right after they made it to the client, but before we could display them (My customer used filemon to watch iexplore.exe do this, actually)…


 


So, even though this isn’t really an SSRS problem per-se, here are the takeaways:


 



  • Verify whether you are using SSL or not, even if you know you haven’t actually configured SSL on your website
  • Use Fiddler to see if the no-cache header is being sent down. 


Comments (20)

  1. Kate the great says:

    I had this error recently on 1 out of 4 servers that we use. I finally found that one of the directories under IIS5 had the nasty "Pragma: No-Cache" setting under Http Headers -> Custom HTTP Headers.  Hope this can help someone else out there.

  2. Greetings,

    Many thanks for this artical – it helped me to get to my solution. In my case, I’m running Apache and serving a dynamically generated PDF file that downloads fine in all popular browsers but IE. My working solution was to add the following lines prior to my other header outputs:

    /**

    * The following Pragma and Cache-Control lines are necessary

    * as the overcome an issue that IE has in some server configurations

    * when the no-cach header is sent. The two lines override these

    * headers, allowing IE to proceed. When not turned on, the error IE

    * provides is:

    *   Internet Explorer cannot download <item URL here instead of item file name> from <domain>.  

    *  

    *   Internet Explorer was not able to open this Internet site. The requested site is either

    *   unavailable or cannot be found. Please try again later.

    */

    header("Pragma: public");

    header("Cache-Control: max-age=0");

    Sean P. O. MacCath-Moran

    http://www.emanaton.com

  3. florsita says:

    THANK YOU!!!!  i’ve waded through a pile of pages trying this and that — clearing cookies, checking for spyware, repairing IE, nothing worked.  downloading fidler and seeing what headers are actually being sent showed me that, indeed, "no-cache" was being set, so Response.ClearHeaders() and setting headers to "Pragma:public" and "Cache-Control:max-age=0" made it work.  My app works again!  THANK YOU, THANK YOU, THANK YOU!

  4. tips his hat

    I’m glad it worked out for you, florsita.  =o)

  5. Reena says:

    I am facing the same problem. But when I checked my server, I found that there was no IIS installed at all! Still trying to figure out what the problem could be 🙁

  6. Arttu Arstila says:

    Hi, I am having the same problem with MOSS2007 & SQL 2005 Reporting Services add-in, cannot export reports to file. Any ideas how MOSS headers could be configured?

  7. Arttu Arstila says:

    I had the same problem with MOSS & RS add-in, although the cache header was set to "private". The problem was solved by unchecking the "Do not store encrypted pages on disk" setting from IE7 advanced settings (in fact it was in our GPO).

  8. Wendy Kleu says:

    Thanks to Sean P. O. MacCath-Moran –

    your Pragma and Cache-Control headers solution sorted out my client’s error when trying to export to excel (IE6, but with company encryption layers causing no-cache).

    Very useful, thank you.

  9. Dan says:

    You are a GENIUS, and have saved me hours of pointless and fruitless messing around trying to resolve this issue!.

    Great.

  10. Nick says:

    Thanks much to Sean, your fix helped me out as well!

  11. Michael Rodriguez says:

    Okay, I’ve inserted Pragma for the header name and Public for the value.  I also inserted Cache-Control for the name and max-age=0 for the value.  I don’t know if I’m missing quotes or not but I can’t get IE to work when I right mouse click and unregistered Mime-type and try to save it to my desktop in IE.  Firefox is fine but not an option for the client.

    Help!

  12. Gita says:

    Hi,

    This helped me in resolving my issue. I was setting the pragma:no-cache http header in my code. So I was not able to export reporting services report into excel, csv or pdf. After removing the code, it solved for me.

    Fiddler helped in finding wether no-cache header was being sent or not

    Thanks a lot for your help.

  13. cesar says:

    im trying to open files from microsoft word from my school course website. but every time i click on the file it tell me Internet Explorer cannot download <filename> from (website)im not verygood with comuters. could you tell me how to fix this problem in some detail plz… thanks

  14. cesar says:

    i found this but i have no idea on how to get to it, could you help me plz

    How to Set HTTP Headers for Content Expiration:

    To set content expiration for a Web site, for a virtual folder, or for a file, perform the following steps:

    1.Start Internet Services Manager, or open the MMC that contains the IIS snap-in.

    2.In the Internet Information Services dialog box, click to expand * server_name, where server_name is the name of the server.

    3.Right-click the Web site, folder, or file for which you want to set content expiration (for example, click Default Web Site), and then click Properties.

    4.Click the HTTP Headers tab.

    5.Click to select the Enable Content Expiration check box.

    6.In the Content should box, perform one of the following steps:

    Click Expire after, and then specify a period of time (in minutes, hours, or days) after the content that expires in the appropriate boxes.

    Use this option if you want Web content to expire after a specific length of time.

    -or-

    .Click Expire on, and then click an expiration date and time in the appropriate boxes.

    Use this option when you want Web content to expire after a specific date and time.

    7.Click OK, and then quit Internet Services Manager, or close the IIS snap-in.

  15. exi.mres says:

    We had this problem on one machine… the following steps fixed it 🙂

    1. In Internet Explorer, select "Internet Options…" from the "Tools" menu.

    2. Click on the "Advanced" tab.

    3. Scroll down to the "Security" section.

    4. Un-tick the "Do not save encrypted pages to disk" check box.

    5. Click the "OK" button.

  16. Tony says:

    I’m getting a similar problem.  I have a servlet that displays an thumbnail image from the database.  If I click on the image, a new window opens with a full-size image.  This works fine when I use Firefox.  IE fails with the error.  If I enter the exact same URL in IE’s nav bar, it works fine.

    IE wastes far too much of my time. >:-(

  17. Ameya says:

    Hi,

    I have verified that  no-cache is being sent down

    But then the question, how do I remove cache-control:  no-cache from reportviewer page / web control?

    Its being sent out may be because of the reserved.reportviewer.axd web handler.. and may be not the IIS..

    How should that be detected and avoided?

    Thanks in advance

    Ameya

    ameyagholap@gmail.com