Can someone explain why the default Asp.Net template template with individual user identification contains an error in the control manager?
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> SendVerificationEmail(IndexViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
var email = user.Email;
await _emailSender.SendEmailConfirmationAsync(email, callbackUrl);
StatusMessage = "Verification email sent. Please check your email.";
return RedirectToAction(nameof(Index));
}
In this line of code
return View(model);

The view is Red because there is no SendVerificationEmail view. This is normal? Can this be solved?
I could specify a view for routing as
if (!ModelState.IsValid)
{
return View(nameof(Index),model);
}
but is it really what the Asp.Net team intended it from here?
source
share