ASP.NET Core Tutorialprovides basic and advanced concepts of C# for beginners and professionals.

ASP.NET Core MVC – Form Data Passing

Back to: ASP.NET Core Tutorial

6. Form Data / POST Request

Scope: View to Controller

✅ Use Case:

Handling form submissions using [HttpPost].

✅ Example:

View (Razor):


html
<form asp-action="Create" method="post"> <input name="Name" /> <input name="Age" /> <button type="submit">Submit</button> </form>

Controller:


csharp
[HttpPost] public IActionResult Create(string name, int age) { // Handle data return RedirectToAction("Index"); }

Or using a model:


csharp
[HttpPost] public IActionResult Create(Person person) { // person.Name, person.Age return RedirectToAction("Index"); }

Scroll to Top