开发者

Configure OutputCache for ASCX from web.config's cache profiles

开发者 https://www.devze.com 2022-12-27 05:04 出处:网络
To configure aspx pages\' OutputCache from one place, there is a great tool which is the CacheProfile attribute in <%@ OutputCache %> associated with a custom cache profile defined in the web.confi

To configure aspx pages' OutputCache from one place, there is a great tool which is the CacheProfile attribute in <%@ OutputCache %> associated with a custom cache profile defined in the web.config :

<开发者_高级运维;caching>
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="myProfile" duration="300"  />
        </outputCacheProfiles>
      </outputCacheSettings>
    </caching>

And the line :

<%@ OutputCache CacheProfile="myProfile" VaryByParam="None" %>

does the job. But how to do the same thing for ascx user controls ? CacheProfile isn't in <%@ OutputCache %> :S Is there a workaround ? Thanks.


From http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx :

"Either this attribute (VaryByParam) or the VaryByControl attribute is required when you use the @ OutputCache directive on ASP.NET pages and user controls. A parser error occurs if you fail to include it."

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号