在Controller的操作中,如何获取当前路径信息?

时间:2022-01-27 19:37:50

From within a Controller's action, how can I get the current route information?

在Controller的操作中,如何获取当前路径信息?

How can I loop through the other routes?

我怎样才能遍历其他路线?

1 个解决方案

#1


RouteData is a key/value collection:

RouteData是键/值集合:

this.RouteData.Values["controller"];

..will return the controller of the current route.

..将返回当前路线的控制器。

this.RouteData.Values["action"];

..will return the action, etc..

..将返回动作等。

#1


RouteData is a key/value collection:

RouteData是键/值集合:

this.RouteData.Values["controller"];

..will return the controller of the current route.

..将返回当前路线的控制器。

this.RouteData.Values["action"];

..will return the action, etc..

..将返回动作等。