2

aspx ページの OutputCache を 1 か所から構成するには、 web.configで定義されたカスタム キャッシュ プロファイルに関連付けられた<%@ OutputCache %>のCacheProfile属性である優れたツールがあります。

<caching>
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="myProfile" duration="300"  />
        </outputCacheProfiles>
      </outputCacheSettings>
    </caching>

そして行:

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

仕事をします。しかし、ascx ユーザー コントロールに対して同じことを行うにはどうすればよいでしょうか。 CacheProfile が <%@ OutputCache %> にありません:S 回避策はありますか? ありがとう。

4

1 に答える 1

0

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

「ASP.NET ページおよびユーザー コントロールで @ OutputCache ディレクティブを使用する場合、この属性 (VaryByParam) または VaryByControl 属性のいずれかが必要です。これを含めないと、パーサー エラーが発生します。」

于 2011-11-04T12:00:23.963 に答える