0

I was recently debugging an ASP.NET MVC application (Firefox + Firebug) and I ran into interesting (to me) scenario, all GET requests as expected were passing parameters in querystring, most POST requests were just posting inputs in the form, however there were some POST requests that mixed both querystring parameters and form inputs.

Interestingely enough MVC model binder had no problem at all to build a model from a mix of querystring and posted parameters. Is it a valid and accepted pattern in ASP.NET MVC and HTTP, or is it more of a fault-tolerant implementation of model-binder?

1 Answer 1

2

This is by design - the default MVC model binder will try to match the model parameters from both the URI (query string and/or route data) and the body.

Of course, you could implement your own model binder that behaves differently.

By the way, in ASP.NET Web API, this behavior is no longer like that, and the URI and body parameters are not mixed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.