What is the proper (browser agnostic) way to disable page caching in ASP.NET MVC?
Asked
Active
Viewed 1.4k times
2 Answers
49
Try this:
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public ActionResult NonCacheableData()
{
return View();
}

Robert MacLean
- 38,975
- 25
- 98
- 152

dso
- 9,463
- 10
- 53
- 59
1
If your MVC Action returns JSON instead of HTML such as in an ajax call you cannot use the meta-tag approach.

pilavdzice
- 958
- 8
- 27