BusyBooking by winsmith

Razor Pages basics

A form with no JavaScript. Submit it empty, then with a name, and watch the address bar.

  1. OnGet runs when the page loads.
  2. Submitting POSTs the form to the same URL; OnPost runs. [BindProperty] has already copied the form fields into Input, and the attributes on GreetingInput have filled ModelState with any errors.
  3. Invalid: return Page() re-shows the form with the errors next to the field.
  4. Valid: the message goes into TempData and RedirectToPage() sends the browser back with a fresh GET. That's Post/Redirect/Get: refreshing the page won't resubmit the form.