Skip to main content
added 17 characters in body; edited title
Source Link
marc_s
  • 759.6k
  • 185
  • 1.4k
  • 1.5k

Tag Helpershelpers in ASP.NET Core 8 MVC

The ASP.NET Core MVC TagHelperstag helpers 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 (Whichwhich can be simplified to ~/Admin).

I have decorated the Controllerscontrollers in that area with [Area("Admin")], TagHelpersthe tag helpers 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.

Tag Helpers in .NET 8 MVC

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.

Tag helpers in ASP.NET Core 8 MVC

The ASP.NET Core MVC tag helpers 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")], the tag helpers 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.

edited title
Link

Tag Helpers in .NET 8 MVC

edited tags
Link
Source Link
Loading