When I programmatically set the HttpCachePolicy, ASP.NET also appears to
OutputCache the page.  However, I can't find a way to set different aging
parameters for the server and client caches.  What I need is to be able to
tell browsers to cache the response for 30 days, but have ASP.NET only cache
the response for 2 days.  How can this be done?

Here's how I am currently caching:

  TimeSpan tsMaxAge = new TimeSpan(0, 0, 2592000);
  Response.Cache.SetExpires(DateTime.Now.AddSeconds(tsMaxAge.Seconds));
  Response.Cache.SetCacheability(System.Web.HttpCacheability.Public);
  Response.Cache.SetMaxAge(tsMaxAge);
  Response.Cache.SetValidUntilExpires(false);
  Response.Cache.VaryByParams["id"] = true;


My response takes a relatively long time to generate and is quite large.
The response will actually never change, so I should probably be setting a 2
year timeout (or whatever is the maximum), but only for the browser.  I
can't have ASP.NET keep things around that long because it would quickly
overwhelm my server. Is there a way to do this?  Or is it even an issue?
Perhaps ASP.NET has built-in logic to handle this type of thing.

Thanks, Ryan

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to