john doe
john doe

Reputation: 9660

Invoking ASP.NET MVC Action from within another controller action

I have a controller action Foo. From within Foo I need to pass a GUID to another action called Index. how can I do that?

public ActionResult Foo() {

   return View("Index",someguid); 

} 

 public ActionResult Index(Guid id)

How can I do that?

Upvotes: 1

Views: 25

Answers (1)

matt.
matt.

Reputation: 2369

Precisely what the RedirectToAction method is for.

As Dom mentioned in the comments, this should get you going in the right direction.

public ActionResult Foo() {

   return RedirectToAction("Index", new { id = someguid });

} 

Upvotes: 1

Related Questions