Skip to content

ActionLink RouteData is broken with endpoint routing in 2.2 and 3.0 #11635

Closed
@davidikin45

Description

@davidikin45
  • There seems to be a big change with routing when endpoint routing is enabled in 2.2 and 3.0.
  • What I am noticing is route params aren't passing through when creating action links anymore

HomeController

[Route("profile/{userId}")]
public IActionResult Profile()
{
	return View();
}

[Route("purchases/{userId}")]
public IActionResult Purchases()
{
	return View();
}

Profile.cshtml

@Html.ActionLink("Purchases Link", "Purchases", "Home")

-- 2.2 with options.EnableEndpointRouting = false;
Direct to https://localhost:44353/profile/1234

Expected ActionLink Url: https://localhost:44353/purchases/1234
Actual ActionLink Url: https://localhost:44353/purchases/1234

-- 2.2 with options.EnableEndpointRouting = true;
Direct to https://localhost:44353/profile/1234

Expected ActionLink Url: https://localhost:44353/purchases/1234
Actual ActionLink Url: https://localhost:44353/profile/1234

-- 3.0
Direct to https://localhost:44353/profile/1234

Expected ActionLink Url: https://localhost:44353/purchases/1234
Actual ActionLink Url: https://localhost:44353/Home/Purchases

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesquestion

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions