© Adam Freeman 2017

Adam Freeman, Pro ASP.NET Core MVC 2, https://doi.org/10.1007/978-1-4842-3150-0_27

27. Model Validation

Adam Freeman

(1)London, UK

In the previous chapter, I showed you how MVC creates model objects from HTTP requests through the model binding process. Throughout that chapter, I worked on the basis that the data the user supplied was valid. The reality is that users will often enter data that isn’t valid and cannot be used, which leads me to the topic of this chapter: model validation.

Model validation is the process of ensuring the data received by the application is suitable for binding to the model and, when this is not the case, providing useful information to the user that will help explain the problem.

The first part ...

Get Pro ASP.NET Core MVC 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.