Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidikin45 opened this issue Jun 27, 2019 · 4 comments
Closed
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question
Milestone

Comments

@davidikin45
Copy link

  • 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

@analogrelay analogrelay added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jun 27, 2019
@davidikin45
Copy link
Author

Currently using {culture} in my routes and would be a pain to have to pass it into all action links

@mkArtakMSFT mkArtakMSFT added this to the Discussions milestone Jul 1, 2019
@rynowak rynowak removed their assignment Jul 4, 2019
@davidikin45
Copy link
Author

Would be good to be able to register global ambient route keys such as "culture" and "ui-culture"

@anna-git
Copy link

anna-git commented Nov 6, 2019

Same here, even with tag helpers like "asp-action=""".
Seems like ambient values from model are being ignored

@ghost
Copy link

ghost commented Dec 7, 2019

Thank you for contacting us. Due to no activity on this issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

@ghost ghost closed this as completed Dec 7, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question
Projects
None yet
Development

No branches or pull requests

5 participants