Chapter 18. Model Validation
In the previous chapter, we showed you how the MVC Framework creates model objects from HTTP requests through the model binding process. Throughout that chapter, we worked on the basis that the data the user supplied was valid. The reality is that users will often enter data that we cannot work with, which leads us to the topic of this chapter—model validation.
Model validation is the process of ensuring the data we receive is suitable for binding to our model and, when this is not the case, providing useful information to the user that will help them correct the problem.
The first part of the process—checking the data we receive—is one of the ways we preserve the integrity of our domain model. By rejecting data that ...
Get Pro ASP.NET MVC 3 Framework, Third Edition 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.