【发布时间】:2014-06-06 14:23:36
【问题描述】:
我想存储一些额外的用户信息。据我了解,以下是通常的选择:
public class ApplicationUser : IdentityUser {
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> 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; }
}
这里添加了 FirstName 和 LastName,它们将作为附加字段出现在 AspNetUsers 表中。
但是,现在使用 Asp.Net Identity 似乎还有一个选项可以将此类信息存储在 AspNetUserClaims 表中。
谁能给我解释一下。展望未来,这种信息可以存储在 AspNetUserClaims 中。如果是这样,那么有没有人有这方面的任何例子。
【问题讨论】:
标签: asp.net asp.net-mvc asp.net-mvc-5 asp.net-identity asp.net-web-api2