Asp.net-Mvc

如何重定向到同一控制器中的另一個動作?

  • April 16, 2019

我想重定向到同一控制器中的另一個動作。我們怎樣才能做到這一點?我試過回來

RedirectToAction(“未授權”);

return RedirectToAction("ActionName");

而不是return Redirect("/Elearning/NotAuthorized");這樣做:

return RedirectToAction("NotAuthorized"); // if you're inside the Elearning controller

或者

RedirectToAction("NotAuthorized", "Elearning"); // if calling from other controller

嘗試

return RedirectToAction("SomeAction");

引用自:https://stackoverflow.com/questions/10353931