Base solution for your next web application
Open Closed

Which special characters are allowed by default in usernames? #10433


User avatar
0
varunab created
  • What is your product version? 8.1.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .Net Core

Hello.

what are the allowed values/special characters for the “username” field?

I entered "k!%^)<>?"{}2" and got an error message saying "User name k!%^)<>?"{}2 is invalid, can only contain letters or digits". But I have been able to create usernames containing @, ' and _


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can configure allowed characters as shown below;

    services.Configure<IdentityOptions>(options =>
    {
      options.User.AllowedUserNameCharacters = 
      "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@";
    });
    
  • User Avatar
    0
    varunab created

    thank you