ASP.NET MVC 4 Override Controller Name

2019-07-23 19:59发布

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条回答
Evening l夕情丶
2楼-- · 2019-07-23 20:23

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

Thanks for comments.

查看更多
登录 后发表回答