是否有限制采取行动的好办法,因此,如果你从另一项行动转向,你只能接触这一行动。 例如:
[HttpPost]
public virtual ActionResult Create(MyViewModel vm)
{
if (ModelState.IsValid)
{
// do some work
return RedirectToAction("CreateSuccess");
}
else
{
return View(vm);
}
}
public virtual ActionResult CreateSuccess()
{
// only allow execution if you were redirected from Action "Create"
}