あるコントローラーから別のコントローラーにリダイレクトし、ルート値でオブジェクトを送信していますが、オブジェクトは 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
}
}
オブジェクトの受け渡しが許可されていないためですか?
Personパラメータをオブジェクトではなく文字列に変更して、 だけを送信しようとしたところ、送信person.Nameされました...しかし、なぜですか?