0
我想運行一個調用應用程序,在所有輸出緩存頁面上調用網站,以便爲用戶緩存所有緩存的分頁。使用瀏覽器時,頁面緩存正確,但我希望能夠運行緩存用戶所有頁面的功能。outputcache控制檯應用程序的網站
即時通訊使用new System.Net.WebClient().DownloadString("http://url");
但使用此調用時頁面不會緩存。
Cacheing屬性
[ChildActionOutputCache(("CacheAll"), Location = OutputCacheLocation.Server)]
屬性功能
public class ChildActionOutputCacheAttribute : OutputCacheAttribute
{
public ChildActionOutputCacheAttribute(string cacheProfile)
{
var settings = (OutputCacheSettingsSection)WebConfigurationManager.GetSection("system.web/caching/outputCacheSettings");
var profile = settings.OutputCacheProfiles[cacheProfile];
Duration = profile.Duration;
VaryByParam = profile.VaryByParam;
VaryByCustom = profile.VaryByCustom;
}
}
的web.config的特性屬性
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="CacheAll"
duration="43200"
location="Server"
varyByParam="*"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
你正在使用什麼樣的緩存? – SLaks 2013-02-28 15:22:27
使用costum生成的outputcache屬性標記控制器方法。 – user473104 2013-02-28 15:23:58