Models

Model Binding

  • Retrieves data from various sources such as route data, form fields, and query strings.

  • Provides the data to controllers and Razor pages in method parameters and public properties.

  • Converts string data to .NET types.

Model Binding gets data in the form of key-value pairs from the following sources in an HTTP request:

Form fields

[FromForm]

The request body (for controllers that have the [ApiController] attribute.)

[FromBody]

Route data

[FromRoute]

Query string parameters

[FromQuery]

Uploaded files

-

-

[FromHeader]

Last updated