I can't use email as Username with MVC5 Microsoft.AspNet.Identity


I want to use email (or a dot in the username!) as the username with Microsoft.AspNet.Identity in MVC 5 application. But when I do I get the following error:

User name ... is invalid, can only contain letters or digits.


In the AccountController constructor that takes a userManager as a parameter add the following code:

UserManager.UserValidator = new UserValidator<ApplicationUser>(UserManager)
 { AllowOnlyAlphanumericUserNames = false };
Comments are closed