title: ASP.NET MVC Route: bypass staticfile handler for path
body: <p>I've been googling and tinkering for a couple hours and haven't really made much progress, so hopefully someone here can help.</p>
  
  <p>I'm trying to get all requests to a certain path to be handled by a 3rd party component.  </p>
  
  <p><strong>EDIT</strong> And I need all requests to all other paths to behave normally.</p>
  
  <p>I'm using a route handler with a wildcard mapping like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>routes.Add(new Route("pathiwant/{*EverythingElse}", new MyRouteHandler()));
  </code></pre>
  
  <p>All traditional routes forward correctly to the handler, which forwards nicely to the 3rd party component. When I hit static files (.html, .txt, etc.), they get picked up by the StaticFile handler instead of my handler, so I'm attempting to turn off the StaticFile handler like so (simplified):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;system.webServer&gt;
    &lt;handlers&gt;
      &lt;remove name="StaticFile"/&gt;
    &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>This turns off the StaticFile handler, but MVC still doesn't pick up the route.</p>
  
  <p>I'd prefer not to fall back on creating my own handler and injecting into the ASP request stack since it seems like there should be an MVC-happy way to do this.</p>
  
  <p>Any thoughts?  And thanks.</p>