How can I maintain ModelState with RedirectToAction?

前端 未结 6 960
日久生厌
日久生厌 2020-12-02 05:57

How can I return the result of a different action or move the user to a different action if there is an error in my ModelState without losing my ModelState information?

6条回答
  •  抹茶落季
    2020-12-02 06:39

    Use Action Filters (PRG pattern) (as easy as using attributes)

    Mentioned here and here.

提交回复
热议问题