RedirectToAction(..) with complex deep object fails

前端 未结 4 1858
生来不讨喜
生来不讨喜 2021-01-04 13:18

I\'m trying to pass an object from one controller action to another. The object that I\'m passing around looks more or less like this:

public class Person
{
         


        
4条回答
  •  情歌与酒
    2021-01-04 14:18

    Although this is an old question, I found a great answer to it in what I believe is a duplicate question. The key is the RouteValueDictionary constructor.

    return RedirectToAction("Result", "Dialog", new RouteValueDictionary(person))
    

    Since you have collections, it makes it a bit tricker, but this other answer covers this very nicely.

提交回复
热议问题