views:

577

answers:

2

I seem to run into this error all the time:

No route in the route table matches the supplied values.

An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

The stack trace is just a bunch of MVC garbage.

Obviously I am querying for a non-existent route, but how do I discover which route it was actually trying to query? I would love to know the actual URL and HTTP Method. How can I discover this?

(I'm used to Django where the attempted URL is a part of the exception and would prefer a more efficient method than viewing the source of my page and figuring it out.)

+6  A: 

There's a nice route debugger.

Darin Dimitrov
Stephen Walther also talks about Route Debugging in Chapter 9 of his forthcoming book - currently available here: http://stephenwalther.com/blog/archive/2009/02/06/chapter-2-understanding-routing.aspx
Zhaph - Ben Duguid
+3  A: 

You can use the MvcContrib's RouteDebugger utility class to get a better view what route was handled the request.

All you need to do is add a reference to the MvcContrib, and add this code to the Global.asax

RegisterRoutes(RouteTable.Routes);
RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
Mendy