ASP.net MVC: Completely Disable Caching
public class NoCacheGlobalActionFilter : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
//IE: http://support.microsoft.com/kb/316431
if (!(filterContext.Result is FileResult))
{
HttpCachePolicyBase cache = filterContext.HttpContext.Response.Cache;
cache.SetCacheability(HttpCacheability.NoCache);
}
base.OnResultExecuting(filterContext);
}
}
This is discouraged though. You should rely on the ASP.net caching mechanisms as described in this article