Question

I heard on a recent podcast (Polymorphic) that it is possible to cache a user control as opposed to the entire page.

I think my header control which displays static content and my footer control could benefit from being cached.

How can I go about caching just those controls?

Was it helpful?

Solution

Take a look here
You can use VaryByParam and VaryByControl in the output cache.

OTHER TIPS

I think you can specify OutputCache in the control's markup file like you'd do on an ASPX page. And it'd get properly cached automatically.

Just read up on OutputCache page directive on MSDN and get the parameters right and it should do what you want it to.

It's been a long time since I write classic ASP.NET but I believe that's how it's done.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top