Control Sitefinity caching from Widget / Usercontrol / Custo

Posted by Community Admin on 03-Aug-2018 13:02

Control Sitefinity caching from Widget / Usercontrol / Custom code

All Replies

Posted by Community Admin on 02-Apr-2012 00:00

Hi everyone,
We have some widgets that prefer pages that don't use caching. Sometimes we forget to set this caching option to "none", and then data doesn't show as it should. Is there an option to set the caching settings/option of a page, through a widget that is dragged on to that page?

Best regards, Tys

Posted by Community Admin on 05-Apr-2012 00:00

Hi Tys,

You can set the Page cacheability directly from your user control, for example by plugging in the OnInit event and saying:

protected override void OnInit(EventArgs e)
        
            this.Context.Response.DisableKernelCache();
            this.Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            base.OnInit(e);
        


Kind regards,
Boyan Barnev
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

Posted by Community Admin on 05-Apr-2012 00:00

This seems to update the cache on the entire page, not just the user control.

Is there a way to only disable the cache for the user control?

Posted by Community Admin on 05-Apr-2012 00:00

Looks like what i needed!
Is there a way to do the same thing for the "Enable ViewState" setting?
Thanks!

This thread is closed