1

I know that you can make a redirection from an action to another like:

public ActionResult Index() {
   return View();
}

public ActionResult OtherAction(){
   return RedirectToAction("Index");
}

Good. I didn't found a solution to my question: How to redirect to an action which has parameters ? For example:

public ActionResult Index(string v1, int i1) {
   return View();
}

public ActionResult OtherAction(string value, int size){
   return RedirectToAction("Index", // here need some adjustements or another trick);
}

Sorry for bad question but I didn't find any related questions here, maybe I don't know to use search :)

Snake Eyes
  • 16,287
  • 34
  • 113
  • 221
  • [here's an answer:](http://stackoverflow.com/questions/1257482/redirecttoaction-with-parameter) – markpsmith Sep 11 '12 at 13:45
  • possible duplicate of [ASP.NET MVC Redirect To Action - Need To Pass Data](http://stackoverflow.com/questions/3363842/asp-net-mvc-redirect-to-action-need-to-pass-data) – Josh Sep 11 '12 at 13:46

2 Answers2

7

Use one of the overloads of RedirectToAction which takes a RouteValues object, e.g.

return RedirectToAction("Index", "Controller", new {v1 = "Hello", i1 = 123});
StuartLC
  • 104,537
  • 17
  • 209
  • 285
3
return RedirectToAction("Index", new {v1 = value1,i1=value2} ); 
James
  • 80,725
  • 18
  • 167
  • 237
TigranG
  • 86
  • 4