如何在asp.net核心中使用类来管理用户(身份3.0.0 Rc1)

时间:2016-04-15 11:47:24

标签: asp.net .net asp.net-identity asp.net-core-mvc asp.net-identity-3

我刚刚启动了asp.net核心,现在我想管理一个类中的用户 在mvc 5中,它就像这段代码一样简单:

  var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
        var currentUser = manager.FindById(HttpContext.Current.User.Identity.GetUserId());

但我不知道如何在 identity 3.0.0 Rc1 中管理用户。 我希望你能给我一个好方法

1 个答案:

答案 0 :(得分:0)

@regnauld问好问题;)但是回答一般情况......

您可以在UserManager课程中找到大多数“用户管理”操作。


其他方式:

首先,请阅读Introduction to Identity v3

然后在Visual Studio中使用选定的Authentication: Individual User Accounts选项...

创建新的MVC Core项目

enter image description here


...这将为您提供默认的MVC项目,其中包含“准备使用”AccountControllerManageController,您可以在其中找到很好的示例如何管理身份3中的用户。

相关问题