I have a controller that has an Index function that returns a Task<IActionResult> and it's connected to a basic Index view. Its URL looks like this https://localhost:PORT_NUMBER_HERE/CONTROLLER_NAME/Index/1. As you can see there's also a post id in the URL which determines which post to display in the view. There's another function in the same controller that also returns a Task<IActionResult>. Let's call this second function ProcessData.
I have a try catch in ProcessData that is supposed to redirect back to https://localhost:PORT_NUMBER_HERE/CONTROLLER_NAME/Index/1 upon a catch. There's a return redirect in the catch like this:
return RedirectToAction("Index", new { id = dataPlaceholder.Id });
but instead it redirects to https://localhost:PORT_NUMBER_HERE/CONTROLLER_NAME/ProcessData/1.
I tried changing the catch return to:
return RedirectToAction("Index", "ProcessData", new { id = dataPlaceholder.Id });
but it still redirects to https://localhost:PORT_NUMBER_HERE/CONTROLLER_NAME/ProcessData/1.
So how do I get the code to redirect to https://localhost:PORT_NUMBER_HERE/CONTROLLER_NAME/Index/1?