Can I get the ASP.MVC route from the url?

I define routes in my global.asax, for example:

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = "" }
);

Given the URL:

/somecontroller/someaction/3

Is it possible to determine which route it will map to and get the corresponding route object with the name, url template and default values?

thanks

+3
source share
1 answer

Phil Haack has a blog post with an ASP.NET Routing Debugger that lets you debug any and all routes.

+1
source

Source: https://habr.com/ru/post/1708495/


All Articles