I am using a link to an action in a controller that includes a asp-route-id and when I click the link I get this error. the asp-route-id is a parameter to to the ConfirmDelete action but it seems like .net core is looking for a view with the name that matches the value passed for asp-route-id and I get the following error: InvalidOperationException: The view '11c8d3ac-b5f4-47c0-8d68-b1704f2fdc43' was not found. The following locations were searched: /Views/Account/11c8d3ac-b5f4-47c0-8d68-b1704f2fdc43.cshtml /Views/Shared/11c8d3ac-b5f4-47c0-8d68-b1704f2fdc43.cshtml
My link in the Index view is as follows:
<a asp-action="ConfirmDelete" asp-route-id="@user.Id" class="btn btn-sm btn-danger">Delete</a>
My Confirm Delete Action in the same controller AccountController is
public IActionResult ConfirmDelete(string id)
{
return View(id);
}
My Index and ConfirmDelete views are both in the folder Views/Account with the names Index.cshtml and ConfirmDelete.cshtml; In my Startup.cs I have the following route defined
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});