MVC3 model validation best practice redirect after post / state change

前端 未结 2 655
耶瑟儿~
耶瑟儿~ 2020-12-10 07:27

Given that web apps should always redirect after a POST (or any non-repeatable request to change server-side state) ...

... how are people using MVC3 Model Validatio

2条回答
  •  暖寄归人
    2020-12-10 08:04

    What you mean by the "mandatory" redirect? Often we use a try/catch in controller, if try is successful, you can either redirect to a View(if you NEED to) or can also return any partial view, or anything you need. The catch is often redisplaying the original page with error message since the post request is not success.

    Hope I did not misunderstand you :)

提交回复
热议问题