I have one action has these attributes:
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Server, Duration = 300, VaryByParam = "*")]
and another with
[OutputCache(Location = System.Web.UI.OutputCacheLocation.None)]
and they both use the same View.
In the View, or even in the Action Method, how to I determine what the caching is? i.e. is it a cached page or not? I’ve tried looking at Response.Headers (only has “Server: Microsoft-IIS/7.0), & Response.CacheControl is “private” in both cases.
I haven’t used this in the application, but for the sake of seeing if it’s possible, I’ve done this sample… using Reflection, and a base controller, and calling Initialize() from my action method, the following code gets the OutputCache attributes from the calling method. Then a View or Partial View can get the cache location from the ViewBag.