ASP.NET MVC 4重写控制器名称 [英] ASP.NET MVC 4 Override Controller Name

查看:118
本文介绍了ASP.NET MVC 4重写控制器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在ASP.NET MVC 4中覆盖控制器名称? 这是路由所必需的.

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

[ActionName("some-action-name")]属性可覆盖操作名称.

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

是否可以对控制器类名称进行相同的操作?

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

需要在路由中使控制器名称带有短划线,例如"some-controller-name"而不是"SomeControllerName"

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

推荐答案

已解决路由.这是唯一的方法.

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

感谢评论.

这篇关于ASP.NET MVC 4重写控制器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆