在管理页面 MVC5 上显示自定义配置文件信息

Show custom profile information on manage page MVC5

我尝试通过本教程将自定义数据添加到 MVC5 身份验证中。 http://blog.falafel.com/customize-mvc-5-application-users-using-asp-net-identity-2-0/ 这很好用。 现在我想显示我添加到管理个人资料页面的自定义字段。 在这里您现在只能更改密码。 这是我尝试获取用户信息的控制器:

public async Task<ActionResult> Index(ManageMessageId? message)
    {
        ViewBag.StatusMessage =
            message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
            : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
            : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
            : message == ManageMessageId.Error ? "An error has occurred."
            : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
            : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
            : "";

        var userId = User.Identity.GetUserId();
        //Here starts my error
        var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
        var currentUser = manager.FindById(User.Identity.GetUserId());

        var model = new IndexViewModel
        {
            HasPassword = HasPassword(),
            Logins = await UserManager.GetLoginsAsync(userId),
            BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId),

        };
        return View(model);
    }

通过 var manager = new UserManager ...... 我得到错误 找不到名称空间 'UserStore' 的类型。 但这是 MVC 用于身份验证的标准命名空间。

我是不是遗漏了什么? 提前致谢

如果我引入以下命名空间,该代码对我有用:

using Microsoft.AspNet.Identity.EntityFramework;

你能看看这是否解决了你的问题吗?