Let’s say you set your output cache directive as follows:
<%@ OutputCache Duration='86400' VaryByParam='RegionID' VaryByCustom='ProductID' %>
VaryByCustom – is a string that your application has to interpret in the GetVaryByCustomString override in the gloabal.asax file.
Now, to avoid caching pages for certain ProductIDs you can set the cacheability to private or nocache from your page load for those pages as follows:
VB.NET
Response.Cache.SetCacheability(HttpCacheability.Private)
C#
Response.Cache.SetCacheability(HttpCacheability.Private) ;
Share with