我意识到在我将 IdentityModel 移动到类库并让我的应用程序引用它后,默认创建的 register async 函数停止工作。我的更改基于此链接将 ASP.NET 标识模型移动到类库目前我的 DbContext 和迁移都位于我的类库中,我的应用程序保存连接字符串。移动它时我错过了什么吗?这是我的主应用程序中的注册函数:// POST: /Account/Register [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { var ued = new AspNetUsersExtendedDetails { FirstName = model.FirstName, LastName = model.LastName, Address = "", Notes = "", UserId = user.Id }; RegisterExtendedDetails(ued); await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string 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 <a href=\"" + callbackUrl + "\">here</a>"); return RedirectToAction("Index", "Home"); } AddErrors(result); } // If we got this far, something failed, redisplay form return View(model); }
- 1 回答
- 0 关注
- 143 浏览
添加回答
举报
0/150
提交
取消