Instead of redirecting
[HttpGet] public ActionResult Index() {
Note that using this method, the URL in the browser will still display the Edit URL (e.g. /area_name/edit ), but you can fix this:
- Using redirects (which you said you don't want to do)
- Using JavaScript to update the URL or using
history.back() as suggested by @AlanStephens - Perhaps other methods that do not immediately come to mind.
However, I would ask if this is really the best approach. Usually, users expect different URLs to do different things.
Or, if I understand you correctly and the editing action is called from the Index page,
[HttpGet] public ActionResult Index() { return View(); } [HttpPost]
and just remove /Edit from the game completely. Again, I do not really like this approach.
source share