What you will learn in this chapter:
The wrox.com code downloads for this chapter are found at
www.wrox.com/go/beginningaspnetforvisualstudio on the Download Code tab. The code is in the chapter 12 download and individually named according to the names throughout the chapter.
There is an old saying, “garbage in, garbage out” (GIGO). The implication is clear: When you allow bad data (garbage) into your application, you will have problems from then on out because your application will give you garbage back. The best way to ensure that your application does not have garbage data is to validate as much of the incoming information as possible to ensure that it fits some known criteria, such as ensuring that a phone number includes all digits, that an e-mail address has the correct format, or a quantity is an integer; for all sorts of user-entered pieces of information, you can, and should, define some expectations regarding how that data should appear.
Both MVC and Web Forms provide support to help you keep your application as garbage-free as possible. In this chapter, you will examine ...