我试图重定向到同一控制器动作内的另一个动作称为索引
[HttpGet]
public ActionResult Search(string city)
{
return RedirectToAction("Index", "Rentals", new { CityName = city });
}
这是索引动作
[HttpPost]
public ActionResult Index(String CityName)
{
}
我想念什么吗?
您正在尝试重定向正在搜索匹配操作的操作,但是在这种情况下,没有get操作,因此您必须添加get方法来接受重定向。如果需要,可以在方法中检查HTTPGET或POST
[HttpPost]<---- Remove this
public ActionResult Index(String CityName)
{
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句