简体   繁体   English

如何自定义ASP.NET Identity Core用户名以在注册时允许特殊字符和空格

[英]How to customize ASP.NET Identity Core Username to allow special characters and space while registering

I would like to use some special characters like ø, in the user name. 我想在用户名中使用一些特殊字符,例如ø。 I have set the AllowOnlyAlphanumericUserNames = false , but i'm getting an error like as below. 我已经设置了AllowOnlyAlphanumericUserNames = false ,但是出现如下错误。

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

Can you please help me to solve this. 你能帮我解决这个问题吗?

in startup.cs configure identity services to include allowed chars in user name: startup.cs将身份服务配置为在用户名中包含允许的字符:

services.AddIdentity<AppUser, AppRole>(ops =>
{
    //--- other code

    ops.User.AllowedUserNameCharacters = 
        "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
});

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

相关问题 如何自定义 ASP.NET Identity Core 用户名以允许特殊字符和空格 - How to customize ASP.NET Identity Core Username to allow special characters and space ASP.NET Identity用户名中的特殊语言字符 - Special language characters in username of ASP.NET Identity 具有特殊字符的ASP.NET MVC标识电子邮件/用户名 - ASP.NET MVC Identity Email/Username with Special Characters 如何在 ASP.NET Core 中为 React SPA 自定义身份控制器? - How to customize Identity controller for React SPA in ASP.NET Core? .NET Core Identity - 无法使用包含特殊字符的用户名进行身份验证 - .NET Core Identity - Unable to authenticate with username containing special characters 如何在ASP.NET Core Mvc中将Unicode字符用作UserName? - How to take Unicode characters as UserName in ASP.NET Core Mvc? 如何自定义ASP.Net身份 - How should customize ASP.Net Identity 最佳实践:自定义asp.net core身份授权 - best practice: customize asp.net core identity authorization ASP.Net Core 2.1 中的身份&lt; - 自定义 AccountController - Identity in ASP.Net Core 2.1< - Customize AccountController 自定义 Asp.NET Core Identity Unauthorized Response Type 和 Statuscode - Customize Asp.NET Core Identity Unauthorized Response Type and Statuscode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM