我认为这很容易,但我无法弄明白。
我有自定义路线
routes.MapRoute(
name: "DefaultLocalized",
url: "{language}/{controller}/{action}/{id}",
defaults: new { language = "EN", controller = "Home", action = "Index", id = UrlParameter.Optional }
);
在控制器中我有
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
base.Initialize(requestContext);
ViewBag.language = Internationalization.SetCultureFromUrl(requestContext, "EN");
}
问题是,如何在@Html.ActionLink
中指定语言属性?