OutputCache WORKS but Response.Cache.SetExpires DOES NOT

A

alex

according to docs these two caching methods are equal:

1)
<%@ OutputCache Duration="10" VaryByParam="id" %>

2)
Response.Cache.SetExpires(DateTime.Now.AddSeconds(10));
Response.Cache.SetCacheability(HttpCacheability.Server);
Response.Cache.SetValidUntilExpires(true);
Response.Cache.VaryByParams["id"] = true;


now put code Trace.Write("INSIDE CONTROL"); into page_load()

with method 1 page actually gets cached, each following request for 10
seconds does NOT produce message "INSIDE CONTROL" in page trace info

with method 2 you will see this message on each page request

Now the question - WTF? pardon my french:)

ps: changing HttpCacheability enum value doesnt do anything
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top