I am expecting a POST request with content type set to:
Content-Type: application/x-www-form-urlencoded
Request body looks like this:
first_name=john&last_name=banana
My action on controller has this signature:
[HttpPost]
public HttpResponseMessage Save(Actor actor)
{
....
}
Where Actor class is given as:
public class Actor
{
public string FirstName {get;set;}
public string LastName {get;set;}
}
Is there a way to force Web API to bind:
first_name => FirstName
last_name => LastName
I know how to do it with requests with content type set to application/json, but not with urlencoded.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…