How to cancel OutputCache by a user action ?

C

craigkenisston

Hi,

I have some controls with these:
<%@ OutputCache Duration="500" Shared="true" VaryByParam="None" %>

However, I need that under certain user action, specifically, changing
a value on a dropdownlist with auto-postback, the cache for the control
be cleaned and the content regenerated.

Is there a way to do this ?
 
G

Guest

You should be able to do this with varybyparam="IdOfControl"
This responds to both querystring and formfield items.
Peter
 
C

craigkenisston

Thanks for your response, that's what I was trying, but can I reference
a control that is in the master page ?

I ended up doing it using VaryByParam/VaryByCustom, but that's giving
some problems: all of the sudden the cache stop working and I get
freshly generated pages (I put a time string for testing), eventhough I
just have two different versions of the user control.
Some times it works like 10 seconds, other times like 30, other times
like 2 minutes, then stop working and on every refresh I get a newly
generated page.

What external factors could cause the cache to get invalidated like
this case ?
 
C

craigkenisston

In addition to add this to my control:

<%@ OutputCache Duration="5000" VaryByParam="None"
VaryByCustom="lang"%>

Do I need to setup a cache configuration somewhere else ?
This is the only cache reference I have in all my application and
erratic behavior of the cache is driving me nuts, I have disabled
anti-virus and firewall just in case, still no luck. Out of the blue,
the website begins regenerating the page.
I'm using Asp.Net 2.0, VS2005 8.0.50727.42, .Net v2.0.50727, the
problem is in both debug and non-debug mode.


Regards,
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top