I\'m new to web-api. I want to receive a HTTP POST data using web-api. The content-type is application/x-www-form-urlencoded
, and the request body is like:
create a model
public class MyClass {
public string mac { get; set; }
public string model { get; set; }
}
and use .net JavaScriptSerializer().Deserialize
public void Post([FromBody]string formData){
MyClass obj = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(formData);
//get mac and model by obj.mac obj.model
}
cheers :)