在另一个 ActionResult 中调用 ActionResult

我们可以在另一个动作结果中调用动作结果。

public ActionResult Action1()
{
    ViewData["OutputMessage"] = "Hello World";
    return RedirectToAction("Action2","ControllerName");
    //this will go to second action;
}

public ActionResult Action2()
{
    return View();
    //this will go to Action2.cshtml as default;
}