On my site I have a page on /Home/Index
This is the index page in my HomeController.
To reach this page I have the link:
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
I want to add the same link for a different page, but this page is located on /Products/Food/Index.
I tried the following:
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Products/Food" asp-action="Index">Food</a>
</li>
But this results in /Products%2FFood/Index
in the URL bar.
What can I do to reach this page using the way of referencing pages?
2
Answers
Just use
It is basically same with using anchor tag with asp-*, those are tag helpers
May be you need to change the folder structure like create Area "Products" in that Products add Controller "FoodController.cs" then add a view "Index".
enter image description here
Sample screenshot