![](/img/trans.png)
[英]How to customize ASP.NET Identity Core Username to allow special characters and space
[英]How to customize ASP.NET Identity Core Username to allow special characters and space while registering
我想在用户名中使用一些特殊字符,例如ø。 我已经设置了AllowOnlyAlphanumericUserNames = false
,但是出现如下错误。
用户名tew-wer无效,只能包含字母或数字。
你能帮我解决这个问题吗?
在startup.cs
将身份服务配置为在用户名中包含允许的字符:
services.AddIdentity<AppUser, AppRole>(ops =>
{
//--- other code
ops.User.AllowedUserNameCharacters =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.