title: How to declare Filter attribute globally in Global.asax.cs file
body: <p>I have implemented one action filter in my MVC project. Now I want to add it globally so that I do not need to write filter attribute just above the action methods. I am using BundleMinifyInlineJsCss nuget package.</p>
  
  <p>I have tried with following code in Global.asax.cs file:</p>
  
  <pre><code>GlobalFilters.Filters.Add(new ReplaceTagsAttribute());
  </code></pre>
  
  <p>Here is my filter code:</p>
  
  <pre><code> public class ReplaceTagsAttribute : ActionFilterAttribute
   {
      public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          filterContext.HttpContext.Response.Filter = new BundleAndMinifyResponseFilter(filterContext.HttpContext.Response.Filter);                         
      }
   }
  </code></pre>
  
  <p>I am getting an error: Filtering is not allowed. How can I declare it Globally?</p>
  
  <p>Thanks.</p>