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") ]
}
感謝