I'm trying to implement ASP.Net Identity into existing ASP.Net MVC and Web API applications. However, normal users should be registered using email adresses and administrators should be registered using usernames.
How can I have it this way?
I'm trying to implement ASP.Net Identity into existing ASP.Net MVC and Web API applications. However, normal users should be registered using email adresses and administrators should be registered using usernames.
How can I have it this way?
The simplest way, and I am assuming you mean with locally registered users, not registered with an external identity provider, would be to have separate registration pages for the two different user types. On that page for regular users, only ask for email address, and set the username to the value of the email field when you create the user. On the admin registration, keep the fields separate, perhaps even validating that they are not the same. Finally you will have a Register link for each user type, pointing to the correct page. A variation is using the same page with a parameter that tells you which flavor you want and shows/hides fields as needed.