Guest
Public paste!

NoCacheFilter

By: a guest | Aug 11th, 2010 | Syntax: C# | Size: 0.60 KB | Hits: 238 | Expires: Never
Copy text to clipboard
  1.     public class NoCacheFilter : ActionFilterAttribute  
  2.     {
  3.  
  4.         public override void OnActionExecuting(ActionExecutingContext ActionContext)
  5.         {
  6.  
  7.             HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
  8.             HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
  9.             HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
  10.             HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
  11.             HttpContext.Current.Response.Cache.SetNoStore();
  12.          
  13.  
  14.         }
  15.  
  16.     }