NoCacheFilter
By: a guest | Aug 11th, 2010 | Syntax:
C# | Size: 0.60 KB | Hits: 238 | Expires: Never
public class NoCacheFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext ActionContext)
{
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
}
}