@OutputCacheディレクティブを使用する場合、web.configで次のようにキャッシュプロファイルを定義できます。
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="myprofile" duration="30" enabled="true" varyByParam="myfield"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
ただし、私のアプリには、宣言型の代わりにプログラムによるキャッシュを使用する必要があるページがいくつかあります。例:
Response.Cache.SetExpires(DateTime.Now.AddSeconds(5));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(true);
Response.Cacheを使用してoutputCacheProfilesを活用することは可能ですか?例えば、
Response.Cache.ApplyCacheProfile("myprofile");