-
Notifications
You must be signed in to change notification settings - Fork 10.7k
RedirectToAction() makes the link to HttpPost action instead of GET #23089
Copy link
Copy link
Open
Labels
affected-mostThis issue impacts most of the customersThis issue impacts most of the customersarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-routingseverity-minorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Metadata
Metadata
Assignees
Labels
affected-mostThis issue impacts most of the customersThis issue impacts most of the customersarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-routingseverity-minorThis label is used by an internal toolThis label is used by an internal tool
Type
Fields
Give feedbackNo fields configured for Bug.
Hi !
For GET and POST methods with the same action names,
generates lincorrect link that in my case eventually led to "too many redirects". (as far as I have investigated, it happens because the link is generated to HttpPost method instead of HttpGet when they both have the same name)
The issue happens for route patterns such as [Route("[controller]/{parameter}/action}")]
and does not happen for the route patterns like [Route("[controller]/action/{parameter}")]
Just to mention, HttpPost action has route pattern [Route("[controller]/action")] (parameter passes in ViewModel)
I have managed with the issue having renamed POST methods so that their names don't match with GET methods.
As for me, such behavior seems incorrect (as well as that RedirectToAction considers POST methods at all to generate links) or I might have lack of knowledge about ASP.Net core MVC routing.