On an ASP.NET Core 1.1 application I need to get all registered routes so in a controller action I have:
public IActionResult GetAllRoutes() {
var routes = this.RouteData.DataTokens;
return Ok(routes);
}
This seems to only return parameters of the current route. I also tried:
public IActionResult GetAllRoutes() {
var routes = RouteData.Routers.OfType<RouteCollection>();
return Ok(routes);
}
This seems to only return the current route ...
Any idea how to get all registered routes in an ASP.NET Core application?