更新nuget包后无法找到AuthenticationIdentityManager(vs2013 preview)

时间:2013-10-28 17:05:58

标签: c# asp.net asp.net-mvc visual-studio-2013 asp.net-identity

整个上午都在打这个。以下是我指出的链接,我仍然没有运气:

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网络工具刷新。重启视觉工作室。除了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包都将更新为最新的预发行版本。

2 个答案:

答案 0 :(得分:0)

取决于您希望在此处实现的操作?您可以通过

获取当前的身份验证管理器
var authenticationManager = HttpContext.Current.GetOwinContext().Authentication;

然后会让你做像

这样的事情
authenticationManager.SignOut();

AuthenticationIdentityManager和IdentityStore类不再存在。

答案 1 :(得分:0)

您正在使用的AccountController似乎是由较旧的VS2013版本生成的。使用最新的ASP.NET身份版本最简单的方法是使用VS2013的发行版创建一个包含个人帐户的新MVC项目。这将创建一个与最新的ASP.NET标识程序集兼容的AccountController类。然后将您的AccountController替换为刚刚生成的AccountController。