---
title: "What is Model Binding in ASP.NET Core?"  
description: "What is Model Binding in ASP.NET Core?"  
author: "Utpal Vishwas"  
published: 2025-05-20  
updated: 2025-05-27  
canonical: https://www.mindstick.com/forum/161642/what-is-model-binding-in-asp-dot-net-core  
category: "c#"  
tags: ["c#", "api(s)"]  
reading_time: 2 minutes  

---

# What is Model Binding in ASP.NET Core?

It automatically [maps](https://www.mindstick.com/interview/1164/how-are-site-maps-important-for-the-search-engine-optimization-process) [HTTP](https://www.mindstick.com/blog/217/http-endpoints-in-sql-server-2005-2008) [request](https://www.mindstick.com/blog/255/post-get-and-request-function-in-php) [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) to [parameters](https://www.mindstick.com/articles/87/passing-parameters-in-c-sharp) in [controller action](https://www.mindstick.com/forum/34400/how-to-retrieve-form-values-in-controller-action) methods.

## Replies

### Reply by Ravi Vishwakarma

**Model Binding** in ASP.NET Core is the process that **automatically maps incoming HTTP request data** (from query strings, forms, route data, headers, or body) to **[action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types) method parameters** or **model properties** in [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) actions.

### Key Purpose

To reduce manual data parsing. Instead of reading request data explicitly (like from `Request.Form["name"]`), ASP.NET Core **binds** the data directly to method parameters or objects.

### Example

```cs
public class UserModel
{
    public string Name { get; set; }
    public int Age { get; set; }
}

[HttpPost]
public IActionResult Submit(UserModel user)
{
    // ASP.NET Core binds form or JSON body to 'user' automatically
    return Ok(user);
}
```

If the request contains:

```plaintext
{
  "name": "Alice",
  "age": 25
}
```

The `user` parameter is automatically populated.

### Sources of Data for Model Binding

ASP.NET Core looks in the following places, in order:

1. **Route Data**
2. **Query String**
3. **Form Data**
4. **Request Body** (for `[FromBody]`)
5. **Headers**
6. **Services** (via `[FromServices]`)

You can explicitly specify a source using attributes:

| Attribute | Source |
| --- | --- |
| `[FromQuery]` | URL query string |
| `[FromRoute]` | Route parameters |
| `[FromForm]` | Form data |
| `[FromBody]` | JSON/XML body |
| `[FromHeader]` | HTTP headers |
| `[FromServices]` | Dependency injection |

### Model Binding vs. Model Validation

1. **Model Binding** maps data.
2. **Model Validation** checks if the data is valid (e.g., required fields, value ranges) using attributes like `[Required]`, `[Range]`, etc.

### Summary

1. Model Binding is automatic in ASP.NET Core.
2. It maps HTTP request data to C# parameters or model classes.
3. Supports multiple data sources and is extensible.
4. Reduces boilerplate code and simplifies input handling.


---

Original Source: https://www.mindstick.com/forum/161642/what-is-model-binding-in-asp-dot-net-core

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
