加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core-1.0 – Asp.Net Core 1.0 RTM中CreateIdentityAsyn

发布时间:2020-12-16 03:46:01 所属栏目:asp.Net 来源:网络整理
导读:在ASP.Net Core1.0 RTM中,我正在尝试使用此方法创建Identity: userManager.CreateIdentityAsync() 但我得到这个错误: ‘UserManager’ doesnot contain a definition for ‘CreateIdentityAsync’. 出了什么问题? 解决方法 你可以尝试 IUserClaimsPrincip
在ASP.Net Core1.0 RTM中,我正在尝试使用此方法创建Identity:

userManager.CreateIdentityAsync()

但我得到这个错误:

‘UserManager’ doesnot contain a definition for ‘CreateIdentityAsync’.

出了什么问题?

解决方法

你可以尝试 IUserClaimsPrincipalFactory

ClaimsPrincipal claimsPrincipal = await _claimsPrincipalFactory.CreateAsync(user);
((ClaimsIdentity) claimsPrincipal.Identity).AddClaim(new Claim("user_id",user.Id.ToString()));

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读