asp.net-core-1.0 – Asp.Net Core 1.0 RTM中CreateIdentityAsync方法的替代品是什么?

asp.net-core-1.0 – Asp.Net Core 1.0 RTM中CreateIdentityAsync方法的替代品是什么?,第1张

概述在ASP.Net Core1.0 RTM中,我正在尝试使用此方法创建Identity: userManager.CreateIdentityAsync() 但我得到这个错误: ‘UserManager’ doesnot contain a definition for ‘CreateIdentityAsync’. 出了什么问题? 你可以尝试 IUserClaimsPrincipalFactory 在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()));
总结

以上是内存溢出为你收集整理的asp.net-core-1.0 – Asp.Net Core 1.0 RTM中CreateIdentityAsync方法的替代品是什么?全部内容,希望文章能够帮你解决asp.net-core-1.0 – Asp.Net Core 1.0 RTM中CreateIdentityAsync方法的替代品是什么?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1239548.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-06
下一篇2022-06-06

发表评论

登录后才能评论

评论列表(0条)

    保存