Reputation: 1315
This code seems to work fine in my seed method.
var user = new ApplicationUser
{
FirstName = "abc",
LastName = "abc",
Email = "[email protected]",
UserName = "amit"
};
success = idManager.CreateUser(user, "admin1");
but when i take Emailid in username. user is not created. i am using MVC5 template in vs2012 and asp.net mvc5 identity .
Upvotes: 0
Views: 195
Reputation: 11914
What version of ASP.NET Identity are you using? I earlier versions, the username only allowed alphanumeric characters.
You can override it via the UserValidator
property of the UserManager
like this:
UserManager.UserValidator = new UserValidator<ApplicationUser>(UserManager){ AllowOnlyAlphanumericUserNames = false };
Upvotes: 1