Web API – Reading post data – application/x-www-form-urlencoded

Reading post data – media type application/x-www-form-urlencoded

public void Post([FromBody]int id)

CONTENT-TYPE: application/x-www-form-urlencoded
BODY: id=4

2. Complex Types
public void Post(FormDataCollection form)

3. Model
public void Post(MyModel form)

The second one is JQueryMvcFormUrlEncodedFormatter, which derives from the first one and knows how to map the form data to a concrete type representing a model. For example, a model defined as follow will match a body content with the keys “Id” and “Value”

public class MyModel
public int Id { get; set; }
public string Value { get; set; }


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s