Join Jess Chadwick for an in-depth discussion in this video Validating form post data, part of ASP.NET Core: Razor Pages.
- [Instructor] Now that I've shown how to use Razor Pages…to create a form and post date it back to the server,…let's look at how we can put some restrictions in place…to control what kinds of data the users are allowed to post…to avoid things that don't make sense,…like creating a recipe without a name.…There are two aspects that go into validating form data.…First, you've got to define the validation rules…then you've got to apply those rules against the form…when users attempt to post data back to the server.…
Defining rules in an ASP.net core web application…is very straight forward.…All that is required for most cases is to place…one of ASP.net cores many validation attributes…on the property and the model that you wish to validate.…These attributes come right out of the box…and you can find them…in the system.componentmodel.dataannotations main space.…For instance, I don't want a recipe…to ever have an empty name.…
In order to keep this from occurring,…there are actually two attributes I can use;…the required attribute or the minLength attribute.…
- Creating a new application
- Setting up pages
- Rendering dynamic content
- Reusing markup with layouts
- Increasing the maintainability of pages
- Processing data
- Validating input
- Securing an application
Skill Level Intermediate
Deploying ASP.NET Core Applicationswith Nate Barbettini57m 57s Intermediate
Building Web APIs with ASP.NET Corewith Chris Woodruff1h 7m Intermediate
ASP.NET Core: Test-Driven Developmentwith Richard Rout37m 30s Intermediate
1. Razor Pages Intro
What is Razor Pages?3m 5s
2. Razor Pages Basics
3. Reusing Markup with Layouts
4. Building Maintainable Applications
5. Working with Data
6. Validating User Inputs and Securing Your Application from Unauthorized Users
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.