0

So I'm somewhat new to MVC but am pretty familiar with C#. I'm in the unique position of needing to create AJAX queries to hit controller functions that I haven't written. These controller functions take all sorts of inputs (strings, ints, objects, lists, dictionaries) and I'm having a really tough time finding resources that depict how different types of objects are supplied in the HTTP request.

Basically, does anyone know of any resources that show the HTTP requests for various types of arguments to MVC controllers? For instance, a resource that says something like "here's how a dictionary is supplied to a controller via both HTTP GET and POST "

Much appreciated!

4
  • I'm a little confused. Most http requests come in text (json, query string, multipart form etc..) and the default model binder will try its best to parse those strings into your model type. There is really not much too it, from the implementer side.
    – Jay
    Commented Jun 20, 2013 at 16:09
  • So for instance, if the method that is getting called in the controller takes as an argument MyObject objName, then in the POST data you'll see something like objName.someVar=1&objName.someOtherVar=2. What I'm looking for is examples of all the possible data types that can be supplied to these controllers and what the request looks like! Commented Jun 20, 2013 at 17:38
  • To my knowledge nothing like what you are looking for is in one place. Perhaps if I knew why you were looking for this information I could point you in the right direction. There are lots of ways to get data into a controller/action method. But not much out there as to what the requests actually look like.
    – Jay
    Commented Jun 20, 2013 at 19:59
  • Easiest thing to do is create a model that contains the different types you are looking for and run a get/post request to an action with Fiddler running. Jay is right though - there's not much to it really other than the naming conventions used. Commented Jul 23, 2013 at 14:00

0

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.