1
鉴于这样的:在index.cshtml :剃刀Url.Action和MVC路由
a href="@Url.Action("Create", "Request")">Create Request</a>
的Global.asax:
routes.MapRoute(
"Request",
"request/{action}",
new {controller="Request",action="Create" }
);
它重定向到这个网址:http://localhost:16997/request。 我该如何去http://localhost:16997/request/create?如果我只是在url中输入'create',它会适当地显示create方法的内容。
那不是工作,如果他只是把上面这一项在Global.asax他的路线?由于路由将匹配它可以的第一个路由。 – mattytommo 2012-03-30 14:11:01
如果他完全删除了他的自定义路由,它将会工作,因为它不是必需的。默认路线已经处理了这个。其默认操作是索引。 – 2012-03-30 14:12:07
更新了路线,并正确重定向:http:// localhost:16997/request/create,但浏览器仅显示“未定义”。所有的方法是'返回内容(“请求控制器内部创建方法”); – user1202839 2012-03-30 14:17:01