liveBook · Manning

Form data

As explained in Pro ASP.NET Core 7, Tenth Edition

Form data is the collection of named values submitted by an HTML form to a server.

Form data is the collection of named values submitted by an HTML form. In ASP.NET Core MVC, a controller can read it directly through Request.Form, process each value, and pass results to another request with TempData. section 27.2.1

A basic form-processing flow is:

  • Decorate the receiving action with HttpPost and iterate through Request.Form.Keys to access submitted names and values. section 27.2.1
  • Treat each form value as a string array; join multiple values when storing a simple representation in TempData. section 27.2.1

A submitted product name

Requesting /controllers/form displays a form with a Name input. Submitting a value sends a POST request to /controllers/form/submitform; the controller stores the value in TempData, redirects to Results, and displays it in a table.

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Explains direct Request.Form access, string-array values, filtering, TempData, and redirection, while deferring richer processing.
Examples
Uses a product-name input, FormController actions, a POST route, a localhost URL, and a Razor results table.
What it assumes
Assumes familiarity with MVC controllers, Razor views, routing, and TempData while demonstrating the form-processing wiring.
What you can do after
Apply it via ASP.NET Core MVC to receive named form values, store simple representations, redirect, and display submitted data.
How it connects
Connects HTML forms with controllers, HTTP POST, Razor views, TempData, redirects, and model binding data sources.

Also explained in

Compare how 3 books explain form data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.