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