I'm redirecting from one controller to another, and sending over an object in the route values but the object is coming back as null:
class Person {
string Name {get; set;}
}
FirstController {
ActionResult something() {
Person p = new Person() { Name = "name" };
return redirectToAction("AddPerson", "Second", new { person = p });
}
}
SecondController {
ActionResult AddPerson(Person person) {
//I'm hitting this action method but the "person" object is always null for some reason
//add person
}
}
is it because passing objects around is not allowed?
I tried changing the parameter to a string rather than a Person
object, and sending over just the person.Name
and it sent it over... but why?