Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to redirect to another action in same controller?

i want to redirect to another action in same controller. how can we achieve this? i tried like return

RedirectToAction("NotAuthorized");

like image 410
dinesh Avatar asked Apr 27 '12 15:04

dinesh


2 Answers

return RedirectToAction("ActionName");

Instead of return Redirect("/Elearning/NotAuthorized"); do this:

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

or

RedirectToAction("NotAuthorized", "Elearning"); // if calling from other controller
like image 145
Leniel Maccaferri Avatar answered Oct 12 '22 21:10

Leniel Maccaferri


Try

return RedirectToAction("SomeAction");
like image 27
itsmatt Avatar answered Oct 12 '22 22:10

itsmatt