I upgraded from MVC4 beta to RC and the latest autofac. The following action was binding properly, but now both parameters are null. I see they changed things about the Fo
Not really sure why the change from Beta, but I was able to make it work by changing the action signature to:
[HttpPost]
RedirectModel MyAction(MyActionDTO dto)
and defining MyActionDTO as
public class MyActionDTO
{
public string value1 { get; set; }
public string value2 { get; set; }
}
It was throwing an exception about not being able to bind to multiple body parameters using the two string paramaters. I guess using the DTO object more closely represents what you're sending in the AJAX call (a JSON object).
When you want to avoid using a DTO object, try this:
[HttpPost]
RedirectModel MyAction(dynamic value1, dynamic value2) {
string sValue1 = value1;
string sValue2 = value2;