IUrlHelper.Action() inexplicably takes callsite action context into account for determining target action. #52665
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Milestone
Is there an existing issue for this?
Describe the bug
In a controller action that has an overload with an additional parameter, redirecting from that overloaded implementation to the default action is impossible using
Controller.Url.Action()
.A small reproduction can be seen in this repository: https://github.com/StringEpsilon/route_bug
Within the
Do(string, Mode)
method, any attempt to create an URL toDo(string)
will result instead in a link toDo(string, Mode)
. In this particular scenario that results in an infinite loop of redirects.Expected Behavior
The default IUrlHelper implementation should not pull route parameter information from the current ActionContext to distinguish between method overloads on the same controller. In other words the following call should always produce the same URL, regardless of which method makes that call:
Steps To Reproduce
See this small reproduction repository: https://github.com/StringEpsilon/route_bug
Build & run the project, then click on the link that is rendered by the "Do" view that says "Do with mode". That will trigger the redirect loop described above.
Exceptions (if any)
No response
.NET Version
8.0.100
Anything else?
No response
The text was updated successfully, but these errors were encountered: