Model binding on POST with query string AND form parameters

asp.net-mvc-3

Solution

The controller will get both values. The default model binder will try to find matches for the parameters from both the URI (either query string or route parameters) or the body (and forms data is supported out-of-the-box).

Problem

What is the defined behavior for form binding in ASP.NET/MVC if you POST a form and its action has query parameters and you have form data? For example: ``` <form action="my/action?foo=1" method="post"> <input type="hidden" name="bar" value="2"> </form> ``` If such a form is submitted should the controller get both `foo` and `bar` or only one of them?

Original source