我有幾個usercontrols,我想有一個不同的輸出緩存超時。不同的輸出緩存超時爲不同的用戶控件
我曾嘗試以下,但沒有成功:
- 集cacheprofile(顯然可以只在aspx頁面來完成)。
不要在代碼隱藏以下內容:
Response.Cache.SetExpires(DateTime.Now.AddDays(OutputCaching.QuickTimeout))
Response.Cache.SetCacheability(HttpCacheability.Public)
響應.Cache.SetValidUntilExpires(真);
Response.Cache.VaryByParams.IgnoreParams = true;
顯然只有<%@ OutputCache Duration="6000" VaryByParam="" %>
的作品,而不是有沒有辦法把時間從config-或文件的AppSettings?
簡短的回答是否定的。該文檔說,cacheprofile在usercontrols中不受支持 –