将Azure Active Directory用户绑定到asp.net应用程序数据库中的现有用户

时间:2018-11-13 14:32:44

标签: c# asp.net active-directory asp.net-identity

我正在使用表单验证和asp.net身份的asp.net应用程序。现在,还可以通过Azure目录进行连接。当用户通过AD连接时,他将重定向到应用程序,而我拥有的唯一信息是电子邮件地址(他的Microsoft帐户)。

我试图获取userId和用户名,但它们仍然为空。

我尝试过:

var UserManager = new UserManager();
UserManager.FindByEmail(User.Identity.GetEmail());
UserManager.GetClaims(User.Identity.GetUserId());
UserManager.GetEmail(User.Identity.GetUserId());

但是,user.identity没有GetEmail()的定义。

因此,我想知道如何将该用户(通过AD连接)绑定到应用程序数据库中包含的信息。 请帮助。

0 个答案:

没有答案