Pass complex object with redirect in ASP.NET MVC?

后端 未结 3 1061
半阙折子戏
半阙折子戏 2020-12-11 16:14

Hi,

I have a action that looks like this :

[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Register(AdRegister adRegister         


        
3条回答
  •  天涯浪人
    2020-12-11 16:42

    ASP.NET MVC's tempdata should be perfect for this.

    That said, TempData or Session is one option, but has some downsides like being quite violate and oftentimes murky or difficult to debug. What might be preferable is to "stash" the temporary value in a persistent store, such as the user's profile or your own database, then pass a key through the validate method which can then load the data from said store. This also opens up the possibility of recovering abandoned carts and such.

提交回复
热议问题