Description
Is there an existing issue for this?
- I have searched the existing issues
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 to Do(string)
will result instead in a link to Do(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:
this.Url.Action(nameof(Do), new {templateId = "SomeTemplate"});
// should always equal: /do/SomeTemplate
// but will return: /do/SomeTemplate/<mode> when called from Do(string, Mode)
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