Using Cache with Master and Content pages RRS feed

  • Question

  • User246057125 posted

    If I want to initialize Cache for a Content Form and not within Master Page, is it sufficient to simply add:

    <% OutputCache Duration="5" VaryByParam="*" %>

    on top of the Content Form or some other settings are required?

    Also, if I add the above code in Master Page, will the Cache work for all the content pages?

    Are there any changes required in the web.config file?

    Thursday, November 1, 2012 2:26 PM

All replies

  • User-735357247 posted

    1) VaryByParam setting is based on different query strings provided. If your page generates different content based on the query string, then you need to put * in the output cache directive or else all your users will see the same content.

    Other wise use VaryByParam="None"

     2) You cannot add an OutputCache directive on a master page. You must do the caching instructions programmatically, in code as mentioned below.Every content page that uses the master page needs output caching enabled.


    No other settings are required in web.config

    Saturday, November 3, 2012 5:14 AM