0
這是做我的頭MVC的RouteMap ActionLink的
在routeConfig文件我有以下
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}/{title}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional, title = UrlParameter.Optional },
new[] {"xxx.Controllers"}
);
}
,我使用他們的領域被稱爲EN
和ENAreaRegistration .cs我有
public override string AreaName
{
get
{
return "EN";
}
}
public override void RegisterArea(AreaRegistrationContext routes)
{
routes.MapRoute(
"Menu",
"EN/{action}/{id}/{title}",
new { controller = "Category", action = "Index", id = 0, title = UrlParameter.Optional },
new[] { "xxx.Areas.EN.Controllers" }
);
routes.MapRoute(
"EN_default",
"EN/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "xxx.Areas.EN.Controllers" }
);
}
}
在視圖上我有
@Html.ActionLink(item.Title, item.Title, "Category", new {id = item.id}, new {title = item.Title.Replace(" ", "-")})
我想獲得以下http://localhost:59295/EN/catergory/1/My-Careers
- 這樣的id用於記錄。
但我正在逐漸http://localhost:59295/EN/Category/My Career/1
我想使用的ID爲1,顯示記錄,但其所有的拍攝是我職業生涯 可以請別人幫忙 感謝 碎甲彈
非常感謝贏..對於延遲響應 – hesh