How can I redirect the viewer to a URL?
I noticed that someone asked How to redirect to another webpage in JavaScript/jQuery?, but I\'m not exactly sure where this
Inside your controller call return RedirectToAction().
public ActionResult MyAction() {
return RedirectToAction("Index", "Home");
}
or, it you use T4MVC (and you should ;-))
public ActionResult MyAction() {
return RedirectToAction(MVC.Home.Index());
}
Do not put the if statement in the view - that's not the MVC way. It is the responsibility of the controller to decide whether to redirect to a different view.