Asp.Net MVC中如果希望Action重定向到另外一个Action,则可以使用RedirectToAction,下面是演示代码:
using System.Web.Mvc; namespace MvcApplication1.Controllers { public class ProductsController : Controller { public ActionResult Index() { return View(); } public ActionResult Details(int id) { if (!id.HasValue) return RedirectToAction(“Index”); //return View(); } } }