I want to redirect the Index action of the Home controller to another controller\'s action and nothing else. My code is thus:
public void Index()
{
You have to write this code instead of return View(); :
return RedirectToAction("ActionName", "ControllerName");
Should Return ActionResult, instead of Void
Your method needs to return a ActionResult
type:
public ActionResult Index()
{
//All we want to do is redirect to the class selection page
return RedirectToAction("SelectClasses", "Registration");
}
You will need to return the result of RedirectToAction
.
return RedirectToAction("ActionName", "ControllerName");