As we know, a route is mapped in Global.asax
file, like:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
There is a method/class where I can access route url properties name by providing a route name ?
For example, for Default
, I want to call something like
public object[] GetRoutePropertiesByName(string name) {
// process here the `controller`, `action`, `id` // there might be also other values
}