我已將名和姓添加到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