0

I'm using a System.Web.Caching.OutputCacheProvider. I do not want browsers to cache, I only want to do server caching. I see that when something comes out of my server cache, they get an Expires header of 24 hours in the future. How do I modify this?

Calling HttpContext.Current.Response.Cache.SetExpires() in my Get() method doesn't have an effect and neither does changing HTTP Response Headers->Set Common Headers->Expire Web content in IIS.

mhenry1384
  • 7,538
  • 5
  • 55
  • 74

1 Answers1

0

You can use the Location attribute for OutputCache attribute. For Asp.Net Web Pages

<%@ OutputCache Location="Server" ...%>

For Asp.Net MVC

[OutputCache(Location=OutputCacheLocation.Server)]

After that the classic Response.Expires = 0 approach should be enough (if necessary) to prevent browser caching.

M. Mennan Kara
  • 10,072
  • 2
  • 35
  • 39