0

整个上午都在和这个战斗。这是我被指出的链接,但我仍然没有运气:

http://www.asp.net/visual-studio/overview/2013/release-notes-(release-candidate)

https://stackoverflow.com/a/18426574/1118218(我做了所有接受的答案建议)

https://stackoverflow.com/a/18419011/1118218(与上述相同的问题,但这里的解决方案也不起作用,不解决类)

我安装了 ASPNET web 工具刷新。重新启动视觉工作室。除了 AccountController 之外,一切似乎都正确构建。它找不到 AuthenticationIdentityManager(和 IdentityStore)。

[Authorize]
public class AccountController : Controller
{
    public AccountController()
    {
        IdentityManager = new AuthenticationIdentityManager(new IdentityStore());
    }

    public AccountController(AuthenticationIdentityManager manager)
    {
        IdentityManager = manager;
    }

    public AuthenticationIdentityManager IdentityManager { get; private set; }
}

知道如何让它工作吗?所有与 ASP.NET Identity、Owin、EF 和 MVC 相关的 nuget 包都已更新到最新的预发布版本。

4

2 回答 2

0

您使用的 AccountController 似乎是由较旧的 VS2013 版本生成的。使用最新的 ASP.NET Identity 版本进行这项工作的最简单方法是使用 VS2013 的发布版本创建一个具有个人帐户的新 MVC 项目。这将创建一个与最新的 ASP.NET 标识程序集兼容的 AccountController 类。然后将您的 AccountController 替换为您刚刚生成的那个。

于 2013-10-29T21:41:19.113 回答
0

取决于您希望在这里实现的操作?您可以通过以下方式获取当前身份验证管理器

var authenticationManager = HttpContext.Current.GetOwinContext().Authentication;

然后它会让你做类似的事情

authenticationManager.SignOut();

AuthenticationIdentityManager 和 IdentityStore 类不再存在。

于 2013-10-28T21:08:27.113 回答