我希望测试/处理从 UserManager 返回的特定错误条件,例如:由于用户名已存档,注册失败等
var user = new SiteUser() { UserName = username, Email = RegisterViewModel.Email };
var result = await _userManager.CreateAsync(user, RegisterViewModel.Password);
if (!result.Succeeded)
{
// here I want to test for specific error conditions
// eg: username already on file, etc
// how can I do this?
}
慕容708150
相关分类