ASP.NET MVC路由在映射时具有名称:
routes.MapRoute(
"Debug", // Route name -- how can I use this later????
"debug/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = string.Empty } );
Run Code Online (Sandbox Code Playgroud)
有没有办法获取路由名称,例如上面的例子中的"Debug"?我想在控制器的OnActionExecuting中访问它,以便我可以在调试时在ViewData中设置内容,例如,通过在/ debug /前面添加一个URL ...