how to redirect to another action in same controller?
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
Try
return RedirectToAction("SomeAction");
If you want to return a redirect
return RedirectToAction("NotAuthorized");
is the valid way to do this. Make sure that your method actually exists.
Alternatively, if you don't want a redirect
return View("NotAuthorized");
works as well.