http - How to retrieve HttpPost parameters in c# -


so know works:

[httppost] public string functionthatiuse() {     string id = "";//does nothing     return relevantinfo; } 

then use chrome post extension shown below , have break point in function how know reaches it. it's literally empty post request basically.

dsdf

but when try post parameters i'm having trouble. ideally want this:

[httppost] public string functionthatiuse(string idx) {     string id = ""; //does nothing , different idx     return relevantdata; } 

but when try use error back. i'm pretty sure it's because i'm not formatting content body correctly , i've tried putting other stuff in content body, nothing has worked. know how can send post parameters function using extension? format of i'm doing in code should same (part of requirement).

edit:

here's picture of error:

enter image description here

according microsoft here: http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api

you have add "[frombody]" in parameter list. can have 1 of these types of parameters.

also in chrome post extension under headers need enter:

name: content-type value: application/json


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -