FromQuery attribute
The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter or property value from the request URL's query string.
ASP.NET Core in Action, 3e
The FromQuery attribute is an ASP.NET Core parameter-binding attribute that specifies binding a parameter from query-string data and can name the query target.
- How it is used
- Directs minimal API handler parameters to query-string values when explicit binding or query-key naming is useful.
- How deep it goes
- Explains explicit-source precedence, target naming, repeated-value arrays, and 400 responses, but defers custom binding internals.
- Examples
- Demonstrates paged product endpoints and repeated product IDs renamed through FromQuery(Name).
- What you can do after
- Apply it via ASP.NET Core minimal APIs to select query binding and map repeated or differently named query keys.
Read how ASP.NET Core in Action, 3e explains FromQuery attribute →
Building Web APIs with ASP.NET Core
The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter's value from the request query string.
- How it is used
- Binds complex GET-action parameters from query-string values while preserving the behavior of separate simple parameters.
- How deep it goes
- Explains explicit complex-parameter binding, alternatives, and DTO property usage, but does not detail binder internals.
- Examples
- Uses BoardGamesController.Get with RequestDTO input and demonstrates filtering, sorting, pagination, and response construction.
- What you can do after
- Apply it via ASP.NET Core to bind a request DTO’s properties from GET query parameters.
Read how Building Web APIs with ASP.NET Core explains FromQuery attribute →
Pro ASP.NET Core 7, Tenth Edition
The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter value from the request URL's query string.
- How it is used
- Selects query-string data when default model-binding source precedence is unsuitable or must be made explicit.
- How deep it goes
- Demonstrates parameter and property binding, name overrides, conflicting route values, and structured query-string data.
- Examples
- Uses a conflicting `/index/5?id=1` URL, a bound Product array, and a supplier-creation breakout initiated by GET.
- What you can do after
- Apply it via ASP.NET Core model binding to force parameters or properties to read named values from query strings.
Read how Pro ASP.NET Core 7, Tenth Edition explains FromQuery attribute →
What to know first
- HTTP GETHTTP GET is a safe, idempotent HTTP method that requests a representation of a resource without intending to change its state.
- model bindingModel binding is the process of locating incoming data, converting it to appropriate types, and assigning it to application objects or handler parameters.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
Related concepts
- model bindingconfigures · Model binding is the process of locating incoming data, converting it to appropriate types, and assigning it to application objects or handler parameters.
- SQLuses · SQL is a standardized declarative language for defining, querying, and manipulating data in relational database systems.
- parameterconfigures · A parameter is a value or named input that specifies or influences the behavior, computation, or output of a function, model, or system.
Questions about FromQuery attribute
What is FromQuery attribute?
The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter or property value from the request URL's query string.
Which Manning books explain FromQuery attribute?
ASP.NET Core in Action, 3e, Building Web APIs with ASP.NET Core and Pro ASP.NET Core 7, Tenth Edition.
What should I know before learning FromQuery attribute?
Manning books that teach FromQuery attribute usually introduce HTTP GET, model binding and array first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


