ASP.NET MVC - How to maintain ModelState from a different controller?

后端 未结 5 2306
时光取名叫无心
时光取名叫无心 2021-02-20 18:43

I have a HomeController with an Index action that shows the Index.aspx view. It has a username/password login section. When the user clicks the submit button, it POSTs to a Lo

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 19:19

    Well you could always do this

    return View("~/Views/Home/Index.aspx", myModel);
    

    It's not a real redirect, the clients url will still point to /login/ but at least you have your modalstate

提交回复
热议问题