I have a basic Edit method in my controller that redirects back to a top level listing (“Index”) when the edit succeeds. Standard behavior after MVC scaffolding.
I a
Here is just another option you couold apply for ASP NET MVC.
Normally you shoud use BaseController class for each Controller class.
So inside of it's constructor method do following.
public class BaseController : Controller
{
public BaseController()
{
// get the previous url and store it with view model
ViewBag.PreviousUrl = System.Web.HttpContext.Current.Request.UrlReferrer;
}
}
And now in ANY view you can do like
Enjoy!