title: Filters of GlobalFilterCollection run before Filters of ControllerInstanceFilterProvider
body: <p>I came across a weird behavior but I am not sure if I am on the right track here.</p>
  
  <p>I have a controller which overrides <code>OnException</code> method of the <code>Controller</code> base class.</p>
  
  <pre><code>public class ControllerFiltersController : Controller {
  
      public ActionResult Index() {
  
          throw new NotImplementedException();
      }
  
      protected override void OnException(ExceptionContext filterContext) {
  
          Trace.TraceInformation(
              "ControllerFiltersController Exception: " + DateTime.Now.ToString("hh:mm:ss.fff")
          );
      }
  }
  </code></pre>
  
  <p>I also have an custom ExceptionFilter as follows:</p>
  
  <pre><code>public class HandleErrorCustom : IExceptionFilter {
  
      public void OnException(ExceptionContext filterContext) {
  
          Trace.TraceInformation(
              "HandleErrorCustom Exception Message: " + DateTime.Now.ToString("hh:mm:ss.fff")
          );
      }
  }
  </code></pre>
  
  <p>Then, I registered it as a global filter:</p>
  
  <pre><code>public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
  
      filters.Add(new HandleErrorCustom());
  }
  </code></pre>
  
  <p>What I expected is here for the <em>controller instance filter</em> to run before global filter since the order of filters which are provided by <code>ControllerInstanceFilterProvider</code> is <code>Int32.MinValue</code> and the scope of them is <code>FilterScope.First</code>.</p>
  
  <p>As also explained here: <a href="http://bradwilson.typepad.com/blog/2010/07/service-location-pt4-filters.html" rel="noreferrer">ASP.NET MVC 3 Service Location, Part 4: Filters</a></p>
  
  <p>But the result is different:</p>
  
  <blockquote>
    <p>iisexpress.exe Information: 0 : HandleErrorCustom Exception Message:
    06:56:49.972</p>
    
    <p>iisexpress.exe Information: 0 : ControllerFiltersController Exception:
    06:56:49.974</p>
  </blockquote>
  
  <p>This is an ASP.NET MVC 4 application and I am not aware of any changes which effects the filter ordering behavior of ASP.NET MVC 3. What am I missing here?</p>