我有一個客戶列表,將有發票和電子郵件鏈接到它。ASP.NET MVC路由和結構
我有我的客戶/信息/ 1和客戶/編輯/ 1%的默認路由工作,但想擁有它,而不是像下面
- 客戶 - 列出客戶
- 客戶/ 1 /編輯 - 編輯客戶ID 1
- 客戶/ 1 /詳細信息 - 客戶ID的詳細信息1
- 客戶/ 1 /發票 - 發票清單爲客戶ID 1
- 客戶/ 1 /發票/ 3 - 發票的詳細信息客戶ID爲3 1
我設置以下的路由(默認路由之前)
routes.MapRoute("CustomerActions",
"customer/{customerid}/{action}/{id}",
new { controller = "customer", action = "details", id="" }
);
這似乎是工作,但在我的客戶編輯觀點我有一個像
<%=Html.ActionLink("Back to List", "Index") %>
但它的ActionLink的給出的網址爲
/customer/1/index而不僅僅是/ customer或/ customer/index
不過,如果我指定的客戶/ 1 /細節它將把1的動作和細節,作爲標識 – 2010-02-15 05:44:04