我有一个注册过程,人们提供电子邮件/密码.. 他们也将提供会员资格(或角色)
我的AccountController注册方法看起来像..
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
var result = await UserManager.CreateAsync(user, model.Password);
await this.UserManager.AddToRoleAsync(user.Id, model.SelectedMembershipType);
if (result.Succeeded)
{
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");
ViewBag.Link = callbackUrl;
return View("DisplayEmail");
}
AddErrors(result);
基本上表示未找到UserId。有没有人之前有这个,你能推荐一个解决方案来解决它吗?提前谢谢。