Does SetVaryByCustom work in custom controls?

I think that

Response.Cache.SetVaryByCustom("mykey");

      

does not work from ASCX custom controls. It works from the page. ASCX only works when VaryByCustom is specified in the outputcache directive.

I am using ASP.NET 3.5.

Any help?

+1


a source to share


1 answer


You might consider expressing it as a directive at the top of the ascx:

<%@ OutputCache Duration="1800" VaryByParam="None" VaryByCustom="mykey" %>

      



The answer is a property of the page, not of the control, so it is possible that it does not affect the control layer.

+1


a source







All Articles