【问题标题】:AuthenticationIdentityManager can't be found after updating nuget packages (vs2013 preview)更新nuget包后找不到AuthenticationIdentityManager(vs2013预览版)
【发布时间】:2013-10-28 17:05:58
【问题描述】:

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

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 包都已更新到最新的预发布版本。

【问题讨论】:

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


    【解决方案1】:

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

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

    这会让你做类似的事情

    authenticationManager.SignOut();
    

    AuthenticationIdentityManager 和 IdentityStore 类不再存在。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-06-12
        • 2013-02-08
        • 2016-12-08
        • 2020-07-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多