How to get fresh copy if OutputCache(Location = OutputCacheLocation.Downstream is used

时光怂恿深爱的人放手 提交于 2019-12-24 18:43:17

问题


Mono MVC2 application uses controller below to cache order page in browser.

If F5 is pressed in browser, old page is still returned to browser. How to return fresh page if F5 is pressed ? It looks like page is cached in server but OutputCacheLocation.Downstream must cache page only in borwser. Is this bug?

    [Authorize]
    public class DetailController : ControllerBase
    {
        [OutputCache(Location = OutputCacheLocation.Downstream, Duration = 20 * 60,VaryByParam = "_entity")]
        public ActionResult Index(string _entity, int? orderId)
        {
...

回答1:


I think you may be missing the whole point of caching. Pressing F5 will continue to return the cached page until it has expired (20 mins in your case). If you want to force the server to send the page again you would need to do a hard refresh e.g. Ctrl + F5



来源:https://stackoverflow.com/questions/13120734/how-to-get-fresh-copy-if-outputcachelocation-outputcachelocation-downstream-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!