Are FromUri and FromQuery the same?

I am familiar with FromBodyand FromRoute. They seem clear.

I used FromUrito handle the display of multi-valued parameters in the or list string[].

FromQuery sounds like it, but is there any difference?

+4
source share
1 answer

[FromQuery]the attribute processes the request parameters, i.e. key-value pairs after "?" in the URI. [FromRoute]the attribute processes route parameters going up to "?" in the URI, i.e. in the path parameters.

, "orders/{id}", "id" - , - "orders/123? showHistory = true", "showHistory" .

[FromUri] Web API [FromQuery] ASP.NET Core MVC.

+4

Source: https://habr.com/ru/post/1691343/


All Articles