Globally turn page fragment caching off?

D

DC

Hi,

(ASP.Net 1.1) is it possible to (programmatically and globally)
deactivate page fragment caching? We have only two scenarios,
development stage where we want caching off and testing where we want
caching on. Is this doable? I think there is a config switch in 2.0,
anything in 1.1?

TIA for any hint,

regards
DC
 
J

Juan T. Llibre

From http://aspnet.4guysfromrolla.com/articles/022802-1.aspx
by Scott McFarland :

<quote>
Partial-Page Output Caching, or page fragment caching,
allows specific regions of pages to be cached.

ASP.NET provides a way to take advantage of this powerful technique,
requiring that the part(s) of the page you wish to have cached appear
in a User Control.

One way to specify that the contents of a User Control should be cached
is to supply an OutputCache directive at the top of the User Control.

That's it!

The content inside the User Control will now be cached for the specified period,
while the ASP.NET Web page that contains the User Control will continue to
serve dynamic content.

(Note that for this you should not place an OutputCache directive in the
ASP.NET Web page that contains the User Control - just inside of the User Control.)
</quote>

So, if you don't want page-fragment caching to occur,
just don't place an OutputCache directive in your User Control's code.

If the OutputCache directive is placed in the User Control,
the control's content will be cached ( that's what page fragment caching is ).
 
D

DC

Thanks Juan. Our requirement is to turn fragment caching off
programmatically. Otherwise we need to remove all the output caching
directives of all user- and webcontrols for testing and turn them back
on for load testing. We want a simple switch in our .config file.

Regards
DC
 
J

Juan T. Llibre

I don't think there's a flip switch you can just turn on and off.

See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenetchapt06.asp

How many controls do you have ?
How impractical is it to modify the OutputCache directive on them ?

As a possible alternative, would setting the duration to "1" help ?
( For testing purposes that might help... )

If you're using IIS 6, you can turn off the OutputCache completely in the
processModel section, but that would require that your test environment
be in a different box than the production environment, since it's a
machine-wide setting.
 

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,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top