This is Asp.Net Webform application
This is my POST method in my Apicontroller
public void Post([FromBody]string value)
{
}
I'm with fiddler post process.
I did so experiment.
But it did not.
What is the problem.
Can you help?
I've tried it, I've failed.
public void Post(MyViewModel model)
{
string aa = model.Value;
}
public class MyViewModel
{
public string Value { get; set; }
}
In Fiddler:
Request Body:
Value=hakan
The POST body payload in Fiddler should be:
=foo_bar
instead of:
value=foo_bar
That's just one of those strange things about the model binding in the Web API. If you want to support value=foo_bar
in the POST body payload you could always write a view model:
public class MyViewModel
{
public string Value { get; set; }
}
and then have your method take this view model as parameter:
public void Post(MyViewModel model)
{
... work with model.Value here as usual
}