asp.netwebformsasp.net-membershipasp.net-identitymembership-provider

asp.net identity membership saving both email and username for a user


I would like to know if its possible to save email as part of the identity model for asp.net identity and also if its possible to save both email and username.

I'm able to create account, save username/password but I'm not sure if I can save email as well as part of the identity model.

Also, using the asp.net membership provider before I know there was option to enable/disable login and also check the last login date of a user.

Is that possible with asp.net identity?


Solution

  • ApplicationUser by has a property Email which you can populate before you create the user record. There is even option to make emails unique which is a good idea for email resetting purposes.

    As for enable/disable login you can add your own IsEnabled property to your implementation of ApplicationUser and override SignInManager.SignIn to check if user is logged in or not.

    So "yes" is the answer to both of your questions.