Search code examples
asp.netsqlasp.net-mvcsqlmembershipprovider

how to add properties to sql membership provider for registering users


I'm using sql membership provider and I'm wanting to add Shipping information when users register... The user is required to enter shipping info. What is the best way to approach this / how do I do it if possible?

public class RegisterModel
{
    [Required]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.EmailAddress)]
    [Display(Name = "Email address")]
    public string Email { get; set; }

    [Required]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [DataType(DataType.Password)]
    [Display(Name = "Confirm password")]
    [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
    public string ConfirmPassword { get; set; }
}

Thanks,


Solution

  • Membership provider is only for basic info. ASP.NET also has something like ProfileProvider. The out-of-the-box version shipped with ASP.NET stores information in XML in database along with the data of Membership Provider.

    Classic tutorial: https://web.archive.org/web/20211020111657/https://www.4guysfromrolla.com/articles/101106-1.aspx