MVC寄存器方法坏了

时间:2018-05-09 18:44:51

标签: asp.net-mvc controller asp.net-identity

我正在开发一个基本的MVC项目,几乎是开箱即用的小改进。因此我对用户属性进行了一些定制,但不是太多......但是,从那以后它似乎不再起作用了。我之前完成了相同的操作而没有遇到错误。我出错了什么想法?

IdentityModels:

Typos.header

的AccountController:

    // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit https://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
    //public string                               UserName                            { get; set; }
    public string                               FirstName                           { get; set; }
    public string                               LastName                            { get; set; }
    public string                               Gender                              { get; set; }
    public string                               DateOfBirth                         { get; set; }
    //public string                               Email                               { get; set; }
    public string                               PhoneNumberPrefix                   { get; set; }
    public string                               PhoneNumberSuffix                   { get; set; }
    //public string                               PhoneNumber                         { get; set; }
    public bool                                 PhoneNumberVerified                 { get; set; }
    public string                               BillingAddress                      { get; set; }
    public bool                                 BillingAddressIsShippingAddress     { get; set; }
    public string                               ShippingAddress                     { get; set; }
    public string                               VATNumber                           { get; set; }
    public string                               PreferredLanguage                   { get; set; }
    public DateTime                             RegisteredDateTime                  { get; set; }
    public string                               RegisteredLatitude                  { get; set; }
    public string                               RegisteredLongitude                 { get; set; }
    public string                               RegisteredLocation                  { get; set; }
    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 class UserDbContext : IdentityDbContext<ApplicationUser>
{
    public UserDbContext()
        : base("DefaultConnection", throwIfV1Schema: false)
    {
    }
    public static UserDbContext Create()
    {
        return new UserDbContext();
    }
}

0 个答案:

没有答案