I have a page that has controls that are output caches (partial output caching). These are setup like this:
[PartialCaching(86400, null, null, "campaign.whatwhere", true)]
public partial class controls_LatestEnquiriesListCached : System.Web.UI.UserControl
{
...
With
public override string GetVaryByCustomString(HttpContext context, string custom)
{
if (custom == "campaign.whatwhere")
{
return (CampaignManager.CurrentCampaign.DefaultWorkTypeId ?? 0).ToString() + (CampaignManager.CurrentCampaign.DefaultEnquiryAreaId ?? 0).ToString();
}
return base.GetVaryByCustomString(context, custom);
}
In Global.asax
How can I setup so I can clear this output cache on a specific page?
Is it possible to setup like MyPageWithCachedControl.aspx?ClearCache=true
???
You should use
HttpResponse.RemoveOutputCacheItem(path)
to clear the output cache where path is the virtual absolute path of the user control as specified in the https://stackoverflow.com/a/37167/30594