I have a restful URL for the action of editing a page. This is implemented on the controller as an Edit method, which accepts GET requests and an Edit method that accepts PO
PRG is the right thing to do.
You do a POST to the action and if modelstate is invalid, you just 'export' your modelstate data into a variable and redirect to the get action.
This has the benefit as opposed to the accepted answer that you don't need to rewrite code on the [Post] action to recreate the view.
on the get action you load the ModelState exported from the post one.
TempData is an excellent place to do this stuff, code will be something like this:
[HttpGet]
public ActionResult Edit(int id) {
// import model state from tempdata
...
}
[HttpPost]
public ActionResult Edit(EditModel model) {
// if modelstate is invalid
// save modelstate in tempdata
// redirect to Edit/{id}
// else
...
RedirectToAction("List")
}
this can be automated using AttributeFilters, there an excellent post create by @ben-foster here:
Automatic Validation of Modelstate