Chapter 5. Client and Server Validation

Regardless of how trusting you are, you should not trust anyone on the Internet, and you should validate all the data you receive. With that said, there are two places where you can perform form validation — on the client and on the server. Why do both? Client validation improves usability by not performing a round-trip to the server; it also makes the application more scalable because of fewer hits on the server. Server validation is critical because client validation can be disabled or circumvented. In this chapter, we will lay out a framework for validating on the server and on the client in order to automate and reduce the amount of code that we would have to write for each page requiring validation.

Get ASP.NET MVC 1.0 Test Driven Development: Problem - Design - Solution 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.