Hello i am working on register form and i only have FirstName and email and password fields
i want to user (UserName= email)but keep geting error that the user name cant contain digits or symbol like (@ or _ ) here is my code
public async Task<ActionResult> Register(model model)
var user = new User
UserName = model.Email,
FirstName = model.FirstName,
Email = model.Email,
Enabled = true
var registerResult = new IdentityResult();
registerResult = await UserManager.CreateAsync(user, model.Password);
catch (Exception ex)
EventLogProvider.LogException("AccountController", "Register", ex);
await SignInManager.SignInAsync(user, true, false);
return RedirectToAction("Index", "Home");
foreach (var error in registerResult.Errors)
Have a look at these user name settings in web.config, specifically at CMSEnsureSafeUserNames and CMSUserValidationRegEx as they should be defining this validation logic.
this solution didnt work still get error username email+665@gmail is invalid can only contain
Did you use it in CMS or MVC web.config or both? What line of code produces this error? UserManager.CreateAsync?
i add it web.conf of kentico /cms/web.config
Try doing the same for MVC application because you are running user creation code there, not in CMS.
after checking this option didnt work Dmitry Bastron
Please, sign in to be able to submit a new answer.