title: BeginRequest-like filter in MVC 3?
body: <p>I have some code in my application that I need to execute on every request, <strong>before anything else executes</strong> (even before authentication). So far I've been using the <code>Application_BeginRequest</code> event in my Global.asax, and this has worked fine. But this code needs to hit the database, and doing this from Global.asax doesn't feel right for some reason. Also, the Ninject.MVC3 nuget I'm using won't inject dependencies into my HttpApplication ctor.</p>
  
  <p>So what I decided to do is move this code into its own global action filter. The problem I'm having now is that no matter what Order or FilterScope I give this filter, I can't get it to execute first; my authorization filter always beats it. <a href="http://msdn.microsoft.com/en-us/library/gg416513%28v=vs.98%29.aspx">MSDN</a> seems to confirm this:</p>
  
  <blockquote>
    <p><strong>Filter Order</strong></p>
    
    <p>Filters run in the following order:</p>
    
    <ol>
    <li>Authorization filters</li>
    <li>Action filters</li>
    <li>Response filters</li>
    <li>Exception filters</li>
    </ol>
    
    <p>For example, authorization filters run
    first and exception filters run last.
    Within each filter type, the Order
    value specifies the run order. Within
    each filter type and order, the Scope
    enumeration value specifies the order
    for filters.</p>
  </blockquote>
  
  <p>I know I can use an HttpModule, but that doesn't feel very <em>MVCish</em>, so I am trying to exhaust all possiblities before going that route, which leads to my question:</p>
  
  <p><strong>Is there a BeginRequest equivalent for global action filters?</strong></p>