0

I have added two properties to ApplicationUser class of asp.net mvc identity as below:

public class ApplicationUser : IdentityUser
    {
        public string Name { get; set; }
        public string Phone { 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;
        }
    }

I added those two properties in my view too and now i can create account and log in with newly created account but SURPRISINGLY i don't see the data back in the database table?! What is the trick? I found a similar question but couldn't find a way how to solve my issue. any help will be appreciated!

Not to forget: There is no problem with the connection string all is well about that.

Community
  • 1
  • 1
Coding Freak
  • 418
  • 1
  • 8
  • 27
  • I do not see anywhere in the documentation that this would persist anything to the database. Also you can setup ASP.Identity in many various ways depending on configuration and plugins (like facebook auth or google or whatever). You did not specify how you have it configured and did not provide your configuration. – Igor Apr 18 '16 at 14:03
  • @Igor I don't have any configuration for it and by the way isn't supposed to work by it self? does it needs to be configured first? actually it was working for sometimes but it stopped working – Coding Freak Apr 18 '16 at 14:17
  • asp.net identity has a whole configuration class when you use the default template included in visual studio. It must be configured as you have to specify multiple behavior points like persisting user session, database connections, etc. – Igor Apr 18 '16 at 14:20
  • @Igor sorry for being too lazy what is the name of that configuration class is that included with asp.net mvc application template or not? – Coding Freak Apr 18 '16 at 14:23
  • Can you persist data in `Name` and `Phone` fields? Did you create an EF Migration for database schema change? – trailmax Apr 19 '16 at 11:40

0 Answers0