If you have an controller inside a area like this:
[Area("Products")]
public class HomeController : Controller
{
[HttpGet("[controller]/[action]/{id}")]
public IActionResult Index(int id) => Ok();
public IActionResult Show(int id) => Ok();
}
You'll have routes mapped for /Home/Index and /Products/Home/Show.
¹{ Area = "Products", Path: "/Home/Index" },
{ Area = "Products", Path: "/Home/Show" }
¹ This is missleading since the route is not acessible through /Products/Home/Index due to attribute override.
The solution for me would be to include area into the route path. It makes sense to me because this already happens if you put an attribute route like: HttpGet("[area]/[controller]/[action]") on top of an action.
If you have an controller inside a area like this:
You'll have routes mapped for
/Home/Index
and/Products/Home/Show
.¹ This is missleading since the route is not acessible through
/Products/Home/Index
due to attribute override.The solution for me would be to include area into the route path. It makes sense to me because this already happens if you put an attribute route like:
HttpGet("[area]/[controller]/[action]")
on top of an action.