IIS7: set “no-cache” for all aspx pages but not images/css/js

I would like to not cache my aspx pages anywhere. For some reason IE ignores meta tags which are set from my master page

<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">

I am trying to see if I can set my Http response header to "Cache-Control" - "no-cache". Setting something like

HttpContext.Current.Response.Headers.Add("Cache-Control", "no-cache");
   HttpContext.Current.Response.Headers.Add("Exipres", DateTime.Now.AddDays(-1).ToShortDateString());

in every page would be painful. I am thinking if there is anyway we can set this in IIS7 (add this header to aspx pages, but not images/css/js). Is it possible ?

Edit: As per suggestion in http://technet.microsoft.com/en-us/library/cc753133%28WS.10%29.aspx, adding a custom http response header adds the header to all files including js,css,images. So adding "Cache-Control","no-cache" here did not work either

Edit2: I am thinking about adding a httpmodule . Something similar to http://blogs.technet.com/stefan_gossner/archive/2008/03/12/iis-7-how-to-send-a-custom-server-http-header.aspx. Any suggestions ?



By default IIS only caches static content; you'll have to make adjustments if it's caching non-static content already.

Need Your Help

Showing horizontal bar for datagridview for overflowing cell content

c# .net winforms datagridview

My datagridview abbreviates the rest of the string when the cell is too small to contain the string. How do I make it so that a horizontal scrollbar is shown so that the content can be viewed? ...

Is there a constructor associated with nested classes

java constructor inner-classes

I want to know if there are any constructors involved with inner classes. for example consider the code snippet given below

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.