我已将名和姓添加到ApplicationUser
类。MVC User.Identity.Name,姓氏和名字
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; }
}
还增加了信息RegisterViewModel
我的应用程序成功创建第一次和LastName
表中,但我无法获得姓和名作为对_LoginPartial
“User.Identity.Name”
nope !,不给我“GetName” – Emil 2014-09-03 12:53:01
是正确的名字和姓氏? – 2014-09-03 13:01:59
是的,但是“User.Identity”似乎没有这些信息 – Emil 2014-09-03 13:12:18