What property of the object contains the name of the route that is used when inside the ControllerBase

How to find the name of the route that is used when used inside it in ControllerBase?

For example, I have a route like this:

routes.MapRoute("Search", "{controller}.mvc/{action}/{criterion}", new { controller = "", action = "", criterion = "" });

... and in my ControllerBase I need an Object.Property that contains the "Search" or the name of the route that ControllerBase currently uses, if not a search.

Thank.

-Jessy Houle

+3
source share
1 answer

This question arises several times in various forms. The short answer is that you cannot - the route name is not stored anywhere in the routing data.

. . . .

+2

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


All Articles