我知道你可以从一个动作重定向到另一个动作,如:
public ActionResult Index() {
return View();
}
public ActionResult OtherAction(){
return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)
好.我没有找到我的问题的解决方案:如何重定向到具有参数的操作?例如:
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);
}
Run Code Online (Sandbox Code Playgroud)
对不起,但我没有在这里找到任何相关的问题,也许我不知道使用搜索:)
使用RedirectToAction的一个重载,它带有一个RouteValues对象,例如
return RedirectToAction("Index", "Controller", new {v1 = "Hello", i1 = 123});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1668 次 |
| 最近记录: |