I'm trying to pass down parameters to my Action. There are several parameters that I need to pass down. When debugging, I found that the simple types of parameters got their values, whereas my own class parameters is null.
return RedirectToAction("Histories", new {MyUser = user, sortOrder = "name_desc" });
And here is the Action method:
public ActionResult Histories(ApplicationUser MyUser, string sortOrder, int? page)
I did a research and found , it seems that only objects which can be serialized can be passed down.
So I simply added an annotation [Serializable] on my ApplicationUser class, and it doesn't work.
So I'm wondering what's the best practice to pass down my objects?
I certainly know I can put the MyUser into Session["CurrentUser"], but I just don't like this old fashion.
Thank you.