views:

115

answers:

1

I have an ASP.NET application, and am trying to output cache a certain page, however on every request, the debugger is still hitting the OnLoad method and I get a 200 response back.

I have placed the output cache directive on a page like so:

<%@ OutputCache Duration="60" VaryByParam="None" %>

And ensured I have the OutputCache module

<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>

And have also bypassed URL rewriting just in case. I have tried this using Cassini and IIS 5.1 (XP), however the page is not caching at all.

Are there any other factors which I have not looked at which could affect this feature?

Thanks

+1  A: 

I had the same problem. I found this line of code being called while handling the request that I couldn't cache:

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Commenting this out made Output caching start working again. I would have guessed that the line above would only affect Headers sent to the client/browser. Make sure nothing like this is being executed at any point in the page life-cycle.

Adam Nofsinger