MVC3 RedirectToAction after postback

545 Views Asked by At

With MVC, I hear that it's good practice to get back to a 'GET' action by using RedirectToAction after processing the Http postback. I understand this is so the postback is not repeated should the user refresh the page or bookmark and revisit it. I think that is sensible but after the redirect the model errors are lost so I can't display them using Html.ValidationSummary. What is the recommended practice in this scenario? Many thanks

1

There are 1 best solutions below

0
On

You shouldn't allow to redirect before errors are displayed. In fact, all logic happens before redirect - insert new data, check data, display errors, correct data, save data, redirect, insert new data.