More in this section

Forums / Developing with Sitefinity / Disable cache for user control

Disable cache for user control

2 posts, 0 answered
  1. Nidhi
    Nidhi avatar
    40 posts
    20 Jul 2010
    07 Jul 2011
    Link to this post
    I am working with Sitefinity 4.1.1395.
    I want to disable the caching for a user control only. This is the code Im using, but its ineffective.
    <%@ OutputCache Duration="1" VaryByParam="none" %>

    How can I disable the cache for the control only? I don't want to disable the cache on the entire page.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    07 Jul 2011
    Link to this post
    Hi Nidhi,

    According to MSDN there are two ways

    • Set options declaratively using the @ OutputCache directive in the .aspx file.

    • Use the methods and properties of the HttpCachePolicy class, which is exposed by the Response.Cache object in the page's code.

    The first one - it is possible to do this but for all pages, not for a single one, by replacing frontend root page

    The second one would work if you create a  code behind of your page and add some code to it. The code behind is a class that should inherit from System.Web.UI.Page

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered