0

I am having a post method A() in HomeController in controllers folder, when the method fails or throws some exception, I want to redirect to another post method A() which is in HomeController in Customer area, there are many customer with name eg. FirstCustomer, SecondCustomer,
For first method I am using attribute routing and route is /{customerName}/Home/A?id="xyz"
and using conventional routing for the another A method for which the route is /FirstCustomer/Home/A
I am using .net framework 4.6.1

I have tried return RedirectToAction("A", "Home", new {area = "FirstCustomer"})

but the RedirectToAction() is making the request get, so I am getting notfound error in browser console.

is there any work around for redirecting to another post method from one post method.

  • same question is here [link] (https://stackoverflow.com/questions/10785245/redirect-to-action-in-another-controller) – debug_dk Apr 25 '23 at 08:38
  • Hi @debug_dk, thanks for the suggestion, but in the reference you provided , there it is redirecting to HttpGet method, and in my case I want to redirect to HttpPost method. In my research till now, I have found that there is no any direct way of redirecting to any HttpPost method. also, the RedirectToAction() method makes the request of type GET and not POST. – Linesh Lanjewar Apr 25 '23 at 10:26
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 25 '23 at 17:05

0 Answers0