2

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 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.