I am trying to do two things here:
1. Adding an email field to the UserProfile table (default). It works like a charm. Users can register both a username and an email address.
2. Change the username to use email instead of username, it also works like a charm.
Here is the problem. The above only works when I separate them, as soon as I use both of them the registration process ends with the following message :
Cannot insert the value NULL into column 'UserName', table 'opdb.dbo.UserProfile'; column does not allow nulls. INSERT fails. WebSecurity.CreateUserAndAccount(model.UserName, model.Password, new { Email = model.Email }); WebSecurity.Login(model.Email, model.Password);
I more or less follow the manual found here . In the comments section, I see that others have the same problem, however, the solution is not to set the UserName field to valid values, as indicated in the answers.
The strange thing is that everything works until I use both together. Any ideas? It drives me crazy!
Thank you in advance
Change Could there be a column order in the database? What should the field used for identification be the first column in the table? So, if I want email as an identifier, which should be the first column in the table?
Josef source share