2

It's only caching my static pages right now.

dana
  • 17,267
  • 6
  • 64
  • 88
Noamway
  • 155
  • 5
  • 21

1 Answers1

2

To proxy cache dynamic pages in IIS, you can either set a Cache Control Rule (see http://technet.microsoft.com/en-us/library/ee683925(WS.10).aspx) for all your dynamic pages, or for only those with when no cache control directive exists, or your can set a Cache Control Directive on individual dynamic pages.

Here is a code example of how to set Cache Control Directives on a specific page:

var expires = new TimeSpan(5,0,0,0);
Response.Cache.SetExpires(DateTime.Now.Add( expires ) );
Response.Cache.SetMaxAge( expires ); 
Response.Cache.SetCacheability( HttpCacheability.Public );
Response.Cache.SetSlidingExpiration(true);

Read more about the HttpCachePolicy class, it's methods and properties here: http://msdn.microsoft.com/en-us/library/8haf374f

Geoffrey McGrath
  • 1,663
  • 1
  • 14
  • 35