I have an ASP.NET Core controller that responds to POST requests and accepts data as application/x-www-form-urlencoded
[HttpPost]
[Consumes("application/x-www-form-urlencoded")]
public async Task<IActionResult> RegisterPayment([FromForm]PaymentDetails data)
{
//registerpayment
}
By using Postman, when I POST x-www-form-urlencoded with this body:
orderid:2552
amount:100
it works, and data parameter is correctly bound.
However if I POST it using querystring format like this
orderid=2552&amount=100
It does not bind, all fields in data are null.
I would expect the data to be bound correctly, even when using querystring format, that is urlencoded after all.