8
是否有某种方式可以在区域之间共享部分剃须区域视图?ASP.net MVC - 在区域之间共享部分区域
例如登录部分,如果我使用@Html.Partial("_LoginPartial")
,但是生成的URL是Html.ActionLink
对于调用区域是本地的(尽管部分本身不属于该区域的一部分)。
_LoginPartial.cshtml is in /Views/Shared/_LoginPartial.cshtml
Calling view is inside /Areas/Somearea/Views
Links generated are like: http://example.com/Somearea/Account/Login
But should always be: http://example.com/Account/Login
局部视图来源:
@if(Request.IsAuthenticated) {
<text>Welcome <b>@Context.User.Identity.Name</b>!
[ @Html.ActionLink(@Messages.Logout, "Logout", "Account") ]</text>
}
else {
@:[ @Html.ActionLink(@Messages.Login, "Login", "Account") ]
}
感谢