简体   繁体   English

ASP.NET Identity用户名中的特殊语言字符

[英]Special language characters in username of ASP.NET Identity

I would like to use some special characters like ø in user name. 我想在用户名中使用一些特殊字符,例如ø

But I am facing this error in 但我正面临着这个错误

IdentityResult result = UserManager.Create(applicationUser, password);

Error: 错误:

User name testø is invalid, can only contain letters or digits. 用户名testø无效,只能包含字母或数字。

How we can fix it? 我们如何解决它? How to allow some special characters? 如何允许一些特殊字符?

I found what do I have to do 我发现我该怎么办

 public class ApplicationUserManager : UserManager<ApplicationUser>
    {
        public ApplicationUserManager()
            : base(new UserStore<ApplicationUser>(new ApplicationDbContext()))
        {
            PasswordValidator = new MinimumLengthValidator(4);
            UserValidator = new UserValidator<ApplicationUser>(this)
            { AllowOnlyAlphanumericUserNames = false  }; 
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM