这是我用来创建顶级链接的代码:
@Html.ActionLink("Edit",Url.Action("Edit","Home", new{row.Application_ID}))
// supposed to return /Home/Edit/x (application_id)
相反,它返回: /Home/Home /Edit/x // 当前视图是 Home/Edit
请帮忙。
编辑 1: 路由表信息:
//This is for Edit
routes.MapRoute(
"Edit", // Route name
"Home/Edit/{application_id}", // URL with parameters
new { controller = "Home", action = "Edit", application_id = UrlParameter.Optional } // Parameter defaults
);
// This is the default route, I've modified it to LogOn.
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Account", action = "LogOn", id = UrlParameter.Optional } // Parameter defaults
);