Hit a strange issue where my model is not binding and shows up on the controller as null.
I have a form doing a httppost. My breakpoint in the controller is hit and
Your problem is that you model contains a property named Message
and you also have a parameter named message
The DefaultModelBinder
reads the form values which will include message = "someTextValue"
and searches for model properties that have the name message
. It finds the one in you model and sets it value (all OK so far) but then it finds another one (your parameter) and tries to set the value of a complex object string
value (in effect ContactMessage message = "someTextValue";
) which fails so the model becomes null