0

In my Application_Start I have a call to a RegisterRoutes method that I call the following:

// Do not process any static files
routes.IgnoreRoute(
  "{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|js|css|htm|html|htc)$" }
);

Additionally, I have MiniProfiler configured which I run like so:

    protected void Application_BeginRequest()
    {
        MiniProfiler.Start();

        var profiler = MiniProfiler.Current;
        using (profiler.Step("Application_BeginRequest"))
        {
        }
    }

Now when I launch my website, I am seeing images being profiled:

MiniProfiler image

Which to me seems to state that my IgnoreRoute is not working properly, or the Image should have never made it up to the MiniProfiler state. Am I incorrect in this, or am I doing something wrong?

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
Kyle
  • 17,317
  • 32
  • 140
  • 246

1 Answers1

2

If you are running your application in Integrated Mode all requests go through the managed handler and are intercepted by Application_BeginRequest even those for static resources. What you did with the IgnoreRoute call is that you excluded them from the routing engine and they won't be resolved to any controller actions.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928