How can I get the Route that matches a particular URL string?
For example, let’s say I have a string:
/home/index/3487
How can I fetch the Route in the RouteTable that would get triggered if this string were to be placed in the URL? I know I need to iterate over the RouteTable.Routes collection, but other than that I am not sure…
Thanks for the help.
Phil Haack at Microsoft wrote a nice route debugger that he blogged about in the past ASP.NET Routing Debugger and updated more recently RouteDebugger 2.0. The package can be installed using nuget if you have that installed Route Debugger – 2.1.1.