ASP.NET MVC 4 Override Controller Name

点点圈 提交于 2019-12-11 13:18:15

问题


Is it possible to override the controller name in ASP.NET MVC 4? It's needed for routing.

There is [ActionName("some-action-name")] attribute to override the action name.

Is it possible to do the same for a controller class name?

It's needed to make a controller name in the routing to have dashes, like "some-controller-name" instead of "SomeControllerName"


回答1:


Solved with routes. It's the only way to do it.

Thanks for comments.



来源:https://stackoverflow.com/questions/15831869/asp-net-mvc-4-override-controller-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!