Asp.Net Identity save user without email

前端 未结 5 880
旧时难觅i
旧时难觅i 2021-01-31 03:24

I want to save user without email, like this:

var user = new ApplicationUser { UserName = model.Name };
var result = await UserManager.CreateAsync(user);
         


        
5条回答
  •  有刺的猬
    2021-01-31 04:00

    ASP Identity 2.2 can be set in App_Start\IdentityConfig.cs

        manager.UserValidator = new UserValidator(manager)
        {
            AllowOnlyAlphanumericUserNames = false,
            RequireUniqueEmail = false
        };
    

提交回复
热议问题