I can't seem to get it to "work". Perhaps I'm not even testing it correctly. I've got a <%= DateTime.Now.ToString() %> line in my aspx page. I've tried setting caching declarativly like this
<%@ OutputCache VaryByParam="SchoolId" Duration="180" Location="Server" NoStore="false" %>
I've also tried setting it programmatically via the Response.Cache object. The timestamp always changes.
The web.config originally didn't have an outputCache section. I've added one that looks like
<outputCache enableOutputCache="true" enableFragmentCache="true" sendCacheControlHeader="true" omitVaryStar="false"/>
Always the timestamp changes. What do I try next?
ugh. The issue was a Response.Cache.SetCacheability(HttpCacheability.NoCache) in the Page_Load of a usercontrol buried 3 levels deep from the page. I appreciate the help, though.
-al
It should be pretty easy to enable. I've done it in the past by setting the OutputCache directive in my aspx. I don't think the web.config changes are necessary, as caching is usually enabled by default.
Are you testing with IIS or the dev web server? Are you doing anything that would cause the web server to reset (ie, doing a build) in between your tests?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With