【发布时间】:2015-09-03 13:32:08
【问题描述】:
我正在使用 Asp.Net 身份进行身份验证。当我从应用程序中注销时,它显示以下错误
dependencies 包是我的 angularjs 包,它由许多其他模块组成。 使用 _LoginPartial 页面显示登录、注册和用户下拉列表。
@Html.Partial("_LoginPartial")
_登录部分视图
@using Microsoft.AspNet.Identity
@if (Request.IsAuthenticated)
{
var UserId = User.Identity.GetUserId();
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" , @style="display:inline" }))
{
@Html.AntiForgeryToken()
<div class="pc-name-button">
<a href="" class="pc-header-login-button pc-name-link" header-dropdown-link>
<span class="pc-name">@User.Identity.GetUserName()</span>
<span class="i-icon i-glyph-icon-30-downcarrot"></span>
</a>
<div class="dropdown-menu i-linklist-dropdown pc-header-accountDropdown">
@if (User.IsInRole("Admin"))
{
@Html.ActionLink("Admin Panel", "Index", "Admin")
}
else
{
<a href="#">My Fundraisers</a>
<a href="#"><span class="translation_missing" title="translation missing: en.personal.my_donations">My Donations</span></a>
<a href="#">My Settings</a>
}
<a href="javascript: document.getElementById('logoutForm').submit()" delete-link>Log Out</a>
</div>
</div>
}
}
else
{
<a href="@Url.Action("Login","Account")" class="pc-header-login-button">
Log In
</a>
<a href="@Url.Action("Register","Account")" style="margin-left:7px;" class="pc-header-login-button">
Sign Up
</a>
}
这是控制器动作
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
AuthenticationManager.SignOut();
return RedirectToAction("Index", "Home");
}
我做错了什么需要帮助?
【问题讨论】:
标签: javascript angularjs asp.net-mvc-4 asp.net-identity asp.net-identity-2