The MVC TagHelpers aren’t acting like they used to. When I write something like this:
<a asp-area="Admin" asp-controller="Home" asp-action="Index"></a>
The link redirects me to ~/Home/Index?area=Admin
instead of ~/Admin/Home/Index
(Which can be simplified to ~/Admin
)
I have decorated the Controllers in that area with [Area("Admin")]
, TagHelpers are imported in my _ViewImports
inside ~/Areas/Admin/Views
folder and my routing configuration looks like this:
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapControllerRoute(
name: "areaRoute",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
I can’t figure out what I did wrong. I didn’t have this problem before.