Microsoft.AspNetCore.Identity Identity just can set "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+"

I want set the UserName to Chinese Word, the document

services.Configure<IdentityOptions>(options =>
{
   options.User.AllowedUserNameCharacters =
   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
});

I want to set the word to Chinese word like this

var user = new IdentityUser { Email = "admin@xxx.com", UserName = "管理员" };
var result= userManager.CreateAsync(user, "admin123456"); // 等待异步方法执行完毕

the result is Id = 1, Status = RanToCompletion, Method = "{null}", Result = "Failed : InvalidUserName"



Read more here: https://stackoverflow.com/questions/68463201/microsoft-aspnetcore-identity-identity-just-can-set-abcdefghijklmnopqrstuvwxyza

Content Attribution

This content was originally published by qi peng at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: