I currently have a .net core web app (.Net core 3.1) using the Razor Pages. I have the following folder structure.
Areas (folder)
Users (folder)
Pages (folder)
Index.cshtml
Edit.cshtml
Inside the Index.cshtml I have the view code below. When the application is running it is not generating an href and when I check the html it generates the html as below:
<a class="nav-link text-dark" asp-area="Users" asp-page="/Edit" asp-route-id="56591c1d-88af-48b6-b41b-1948af412511">Edit</a>
@page
@model MyApp.Areas.User.Pages.IndexModel
@{
ViewData["Title"] = "Users";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>Users</h1>
<table class="table">
<thead>
<tr>
<th>Operations</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Users)
{
<tr>
<td>
<a class="nav-link text-dark" asp-area="Users" asp-page="/Edit" asp-route-id="@item.UserId">Edit</a> |
</td>
</tr>
}
</tbody>
</table>