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

标签 c# asp.net-mvc asp.net-identity

我想在用户名中使用一些特殊字符,例如ø

但是我遇到了这个错误

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

错误:

User name testø is invalid, can only contain letters or digits.

我们该如何解决? 如何允许一些特殊字符?

最佳答案

我找到了我必须做的事情

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

关于c# - ASP.NET Identity 用户名中的特殊语言字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26909286/

相关文章:

c# - DataSets to POCOs - 关于 DAL 架构的查询

c# - OpenIdConnectAuthenticationHandler : message. 状态为 null 或为空

c# - UserStore 每个 HttpRequest 的 Unity IoC 生命周期

c# - 如何映射具有对实体的引用的值类型?

c# - 多键数据结构

asp.net - HttpClient 可以有多个 HTTP 消息处理程序吗?

c# - Azure 应用服务 File.ReadAllText 返回文件未找到异常,但文件存在于该位置

c# - 如何在 ASP.net core Identity 中实现基于权限的授权?

c# - 在 .NET 中,如何向需要身份验证的 Web 服务提供 session 标识符?

c# - 存储在azure blob存储中时如何获取图像尺寸?