Frequently Asked Interview Questions

What is the use of VaryByParam attribute of @OutputCache page directive?

What is the use of VaryByParam attribute of @OutputCache page directive?

Multiple versions of a page can be cached if the output used to generate the page is different for different values passed in via either a GET or POST.


Example:

<%@ OutputCache Duration="45" VaryByParam="id" %> --> It cache Pages varied by parameter id for 45 seconds.

<%@ OutputCache Duration="45" VaryByParam="id;code" --> It cache Pages varied by parameters id or code for 45 seconds.

<%@ OutputCache Duration="45" VaryByParam="*" --> The cached content is varied for all parameters passed through the querystring.

<%@ OutputCache Duration="45" VaryByParam="none" --> No page cache for multiple versions


Caching FAQSASP.NET Caching Article


Most Visited Pages

Home | Site Index | Contact Us