小编Emi*_*mil的帖子

具有名和姓的MVC User.Identity.Name

我已将ApplicationUserClass 和Last名称添加到Class中.

 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; }
    }
Run Code Online (Sandbox Code Playgroud)

还添加了信息 RegisterViewModel

我的应用程序成功创建了First和LastName表,但是我无法获得在_LoginPartial "User.Identity.Name"中显示的名字和姓氏

asp.net razor asp.net-mvc-4 asp.net-identity

9
推荐指数
1
解决办法
9585
查看次数

标签 统计

asp.net ×1

asp.net-identity ×1

asp.net-mvc-4 ×1

razor ×1