Noamway
Noamway

Reputation: 195

Can I set in the IIS ARR (reverse-proxy) cache for dynamic pages?

It's only caching my static pages right now.

Upvotes: 2

Views: 1744

Answers (1)

Geoffrey McGrath
Geoffrey McGrath

Reputation: 1673

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

Upvotes: 2

Related Questions