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 :)
使用RedirectToAction的重载之一,该重载采用RouteValues对象,例如
return RedirectToAction("Index", "Controller", new {v1 = "Hello", i1 = 123});
return RedirectToAction("Index", new {v1 = value1,i1=value2} );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.