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
 
Joined
Jul 5, 2006
Messages
1
Reaction score
0
Try this

'(to cache an object for 10 seconds)
Dim cd As Caching.CacheDependency
Cache.Insert(sCacheObjectName, oObjectToBeCached, cd, Now.AddSeconds(10), New TimeSpan(0, 0, 0))
 

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

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top