Say I have a controller with an Index Method and a Update Method. After the Update is done I want to redirect to Index(). Should I use return RedirectToAction(‘Index’) or can I just call return Index()? Is there a difference?
public ActionResult Index() { return View('Index', viewdata); } public ActionResult Update() { // do updates return RedirectToAction('Index'); or return Index(); }
Use the redirect otherwise the URL on the client will remain the same as the posted URL instead of the URL that corresponds to the Index action.