我已经按照
http://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity中的描述更改了PK,但是在我尝试登录后,我收到以下错误.登录部分成功,因为“this”包含所有相关数据,但创建身份似乎失败
从物化的“System.String”类型到“system.int32”类型的指定强制转换无效.
在线
var userIdentity = await manager.CreateIdentityAsync(this,DefaultAuthenticationTypes.ApplicationCookie);
public class ApplicationUser : IdentityUser<int,CustomUserLogin,CustomUserRole,CustomUserClaim> { public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser,int> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationoptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this,DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return userIdentity; } public string FirstName { get; set; } public string LastName { get; set; } }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。