So, according to this:
- If the parameter is a “simple” type, Web API tries to get the value from the URI. Simple types include the .NET primitive types (int, bool, double, and so forth), plus TimeSpan, DateTime, Guid, decimal, and string, plus any type with a type converter that can convert from a string. (More about type converters later.)
- For complex types, Web API tries to read the value from the message body, using a media-type formatter.
I have a POST action with a single string parameter coming from the user's input and can therefore be any character - foreign, unicode, apostrophe, '%20' etc. anything!
I am therefore reluctant to have this parameter in the URL and the [FromBody] decorator doesn't appear to be helping. Question is: what is the best [a-hem] pratice for posting a single string parameter to WebAPI controller?
C#:
[HttpPost]
[Route("api/add")]
public void Add([FromBody]string name)
{
// name is null :(
}
JS:
function add(name: string) {
return this.$http.post("api/add/", name);
}

[FromBody]attribute from angular. I sent my value in request body. And it works. Can you check the request that it generates? (in browser or fiddler)/localhost/****/in your image :p