title: How can an Attribute prevent the execution of an MVC Action?
body: <p>In <code>MVC</code> an <code>OutputCacheAttribute</code> is capable to prevent the execution of the action it is decorating (if the relative cache exists)</p>
  
  <p>How to implement the same mechanism with a custom attribute?</p>
  
  <p>In other works I would like to be able to decorate an action, and based on a logic internal to the attribute it will decide whether the action should carry on executing or not.</p>
  
  <p><strong>Additions</strong></p>
  
  <p>I've implemented a mechanism by which if a request to an action arrives with a querystring like <code>flushaction=flush_silent</code>, the custom attribute (which is extending the <code>OutputCacheAttribute</code>) invalidates the cache.</p>
  
  <p>What I would also like to do, is not to execute the Action:</p>
  
  <pre><code>[JHOutputCache(CacheProfile = "ContentPageController.Index")]
  public ActionResult Index(string url)
  {
       //custom code that should not execute when flushing the cache
  }
  </code></pre>