What is the proper (browser agnostic) way to disable page caching in ASP.NET MVC?
Asked
Active
Viewed 1.3k times
2 Answers
49
Try this:
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public ActionResult NonCacheableData()
{
return View();
}
Robert MacLean
- 38,615
- 24
- 98
- 151
DSO
- 9,283
- 10
- 51
- 58
1
If your MVC Action returns JSON instead of HTML such as in an ajax call you cannot use the meta-tag approach.
pilavdzice
- 948
- 8
- 27