public async Task <IActionResult> ConfirmEmail(string userId, string token) { //if (userId == null || code == null) //{ // return RedirectToAction(nameof(HomeController.Index), "Home"); //} var user = await _userManager.FindByIdAsync(userId); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{userId}'."); } var result = await _userManager.ConfirmEmailAsync(user, token); if (result.Succeeded) { var strHomeUrl = _config["ReturnURL"]; var strRedirect = new Uri(strHomeUrl).ToString(); var strMessage = EmailTemplates.GetConfirmationMessage(strRedirect); return(Content(strMessage, "text/html")); } throw new ApplicationException($"Unable to confirm email for user with ID '{userId}'."); }