Avatar ·

How to pass a parameter in the RedirectToAction method in ASP.NET MVC?

Hello everyone! I'm a beginner in ASP.NET MVC and C#. I've encountered a problem when using `RedirectToAction`. I need to redirect the user to another controller action after processing a form and pass some parameter there (e.g., a record ID or a success message). Here's an example of my code. There is a `HomeController` with two actions: ```csharp public class HomeController : Controller { public ActionResult Index() { return View(); } [HttpPost] public ActionResult Create(string name) { // Here I save data, get ID = 123 int newId = 123; // Trying to redirect to Details with id parameter return RedirectToAction("Details", new { id = newId }); } public ActionResult Details(in