Skip to main content

Posts

Showing posts from January, 2009

IE7 and no-cache HTTP headers

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 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 ...