我试图注销一个页面并将其重定向回主页,但它似乎无法离开该区域。
<div class="container">
<div class="pull-right">
<div class="span12">
@using (Html.BeginForm("LogOff", "Account", new { area = ""}, FormMethod.Post, new { id = "logoutForm" }))
{
@Html.AntiForgeryToken()
<text>
Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", htmlAttributes: new { @class = "username", title = "Manage" })! | <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
</text>
}
</div>
</div>
</div>
上面是_LoginPartial.cshtml。
当您登录时,它会将您发送到成员区域,然后当您点击注销时,URL 更改
/member/account/logoff
看起来像是试图在成员区域中找到帐户控制器以调用注销的操作结果,但帐户控制器位于根目录中最初创建它的项目。