Thursday, October 2, 2014

Web API: Binding to form data

Just a quick ASP.NET Web API tip today…

If you want to access the form data posted to a an ASP.NET Web API controller, the easiest solution is to use the built-in FormUrlEncodedMediaTypeFormatter, which knows how to map every key/value in the form data to a FormDataCollection.

In your controller method, you can specify the FormDataCollection as a parameter:

No comments: