【发布时间】:2011-12-29 06:26:14
【问题描述】:
我有一个页面,其中包含作为输出缓存(部分输出缓存)的控件。这些设置如下:
[PartialCaching(86400, null, null, "campaign.whatwhere", true)]
public partial class controls_LatestEnquiriesListCached : System.Web.UI.UserControl
{
...
与
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);
}
在Global.asax
如何设置才能清除特定页面上的此输出缓存?
是否可以像MyPageWithCachedControl.aspx?ClearCache=true一样设置???
【问题讨论】:
-
这些完全相同的副本如何?
-
您应该使用 HttpResponse.RemoveOutputCacheItem(path) 清除输出缓存,其中 path 是stackoverflow.com/a/37167/30594中指定的用户控件的虚拟绝对路径
标签: c# asp.net global-asax fragment-caching