How can I disable client side and proxy caching in ASP.NET MVC?

后端 未结 2 1813
醉酒成梦
醉酒成梦 2020-12-01 10:54

What is the proper (browser agnostic) way to disable page caching in ASP.NET MVC?

相关标签:
2条回答
  • 2020-12-01 11:02

    If your MVC Action returns JSON instead of HTML such as in an ajax call you cannot use the meta-tag approach.

    0 讨论(0)
  • 2020-12-01 11:08

    Try this:

    [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
    public ActionResult NonCacheableData()
    {
        return View();
    }
    
    0 讨论(0)
提交回复
热议问题