I use api controller in ASP.net web API and i need to pass value to post method by [FromBody] type..
[HttpPost]
public HttpResponseMessage Post( [FromBody]string name)
{
....
}
i use Postman plugin but when send to post method value of name always is null.. follow this image:
and in Post methods :
why this happend?!
解决方案
You can't bind a single primitive string using json and FromBody, json will transmit an object and the controller will expect an complex object (model) in turn. If you want to only