ASP.NET MVC Model Binding

Posted by Noel on Stack Overflow See other posts from Stack Overflow or by Noel
Published on 2010-03-23T21:29:22Z Indexed on 2010/03/23 21:33 UTC
Read the original article Hit count: 479

Filed under:
|

If i have a Controller Action that may recieve both HTTP GET and HTTP POST from a number of different sources with each source sending different data e.g.

  1. Source1 performs a form POST with two form items Item1 and Item2
  2. Source2 performs a GET where the data is contained in the query string (?ItemX=2&ItemY=3)

Is it possible to have a controller action that will cater for all these cases and perform binding automatically e.g. public ActionResult Test(Dictionary data) { // Do work ... return View(); }

Is this possible with a custom binder or some other way? Dont want to work directly with HttpContext.Request if possible

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about binding