MVC3问题路由器? [英] MVC3 Problem router ?

查看:93
本文介绍了MVC3问题路由器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a project developed in asp.net MVC3 but its default router can not sign "-". Now I want the router as an example URL:
http://localhost:3578/Trang-chu/am-nhac/bai-hat-english.
How to do it?

推荐答案

您可以在任何操作参数中使用连字符而无需任何更改。要在操作名称中使用连字符,可以将其作为属性提供,例如

You can have the hyphen in any action parameters without any change. To have hyphen in action name, you can provide it as an attribute like
[ActionName("In-dex")]
 public ActionResult Index()





因此URL将包含动作的In-dex。



无论如何,我没有看到任何一点 - 在动作名称中它会令人困惑。



So the URL will contain In-dex for the action.

Anyways, I didn't see any point in having - in the actionname it will be confusing.


你确定参数不存在' - '?
Are you sure that parameters can't exist '-' ?


这篇关于MVC3问题路由器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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