If you ever want to make it so IE7 will not download a file, set the Cache-Control or Pragma headers to "no-cache".
Some time in the past, I thought I learned that when you want to stop a proxy server from caching a file (apart from or in addition to the actual client), you set the following headers: "Cache-Control: no-cache" and "Pragma: no-cache". In C# ASP, that equates to the lines
(I believe the
If you send either of those 2 headers, you'll get a completely useless error message from IE7 when clicking a link to the page---you'll see "Internet Explorer cannot download filename from domain/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". If you right-click the link and choose "Save Target As...", you get a slightly better error message: "Internet Explorer cannot download filename from domain/server ... The file could not be written to the cache".
That's what led me to the headers. After removing them both, the file downloads as expected. It would have been much simpler to figure it out if IE7 had an error console like FireFox (or at least something like FireBug).
Some time in the past, I thought I learned that when you want to stop a proxy server from caching a file (apart from or in addition to the actual client), you set the following headers: "Cache-Control: no-cache" and "Pragma: no-cache". In C# ASP, that equates to the lines
Response.Cache.SetCacheability(HttpCacheability.NoCache);
and Response.AppendHeader("Pragma", "no-cache");
(I believe the
Response.Cache.SetMaxAge(TimeSpan.Zero);
line was also suggested to me as part of this, but I can't remember anymore.)If you send either of those 2 headers, you'll get a completely useless error message from IE7 when clicking a link to the page---you'll see "Internet Explorer cannot download filename from domain/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". If you right-click the link and choose "Save Target As...", you get a slightly better error message: "Internet Explorer cannot download filename from domain/server ... The file could not be written to the cache".
That's what led me to the headers. After removing them both, the file downloads as expected. It would have been much simpler to figure it out if IE7 had an error console like FireFox (or at least something like FireBug).
Comments