N0rita
N0rita

Reputation: 11

How to redirect to an action in different controller in ASP.NET MVC2?

I'm in an action of CustomersController and I want to redirect to another action of a different controller.

I tried to use

RedirectToAction("ActionName", "ControllerName");

but it doesn't work! How can I do it ?

Additionally, how can I pass some parameters?

Upvotes: 0

Views: 275

Answers (1)

devdigital
devdigital

Reputation: 34349

Ensure you are returning the result of RedirectToAction

return RedirectToAction("Action", "Controller", new { id = 5 });

Upvotes: 1

Related Questions