Click here to Skip to main content
15,886,100 members
Articles / Web Development / ASP.NET
Article

Input and Data Validation

Rate me:
Please Sign up or sign in to vote.
4.33/5 (3 votes)
11 Oct 2013CPOL2 min read 8.3K   4   1
Garbage in, garbage out. You can avoid data cleanup tasks on the backend by avoiding bad data coming in.  ASP.NET validation controls and third party

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

Garbage in, garbage out. You can avoid data cleanup tasks on the backend by avoiding bad data coming in.  ASP.NET validation controls and third party validation controls help you receive the right data in the right format.  In addition, the AJAX Control Toolkit employs extenders that can prevent invalid data from being entered in the first place.  For instance, the FilteredTextBoxExtender can prevent unwanted characters from being entered into the textbox.  The MaskedEditExtender restricts the format of the input being entered.

Whitepapers

How To

Controls

Resources

Podcasts

Video

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
This is a Collaborative Group

754 members

Comments and Discussions

 
GeneralThe problem of GIGO Pin
dojohansen22-Jun-15 4:27
dojohansen22-Jun-15 4:27 
This is a general comment on the problem of GIGO more than the article specifically. But I do feel the author is rather too optimistic in his premise:

> You can avoid data cleanup tasks on the backend by avoiding bad data coming in.

Oh, really?

Developers tend to think of input quality more or less only so far as to whether or not the input is "well-formed". Input that is malformed can cause the kind of problems that developers are bound to hear about - it makes software crash.

But the real problem is far more complicated than that. In some cases, efforts such as this to improve data quality have precisely the opposite effect. Consider what you do yourself when faced with a computer system that insists on you, the user, providing perfect information that you don't necessarily have on hand, or that simply doesn't interest you. Municipality is a required field? So you choose a municipality. It may not be TRUE, but you have to, since the system just won't let you honestly say "I don't know" or "I can't be bothered".

Most companies and institutions do next to NOTHING to actually check if the information in their systems is *accurate* - that is, whether it is TRUE. Everyone seems to assume that if no errors occur, the information is probably correct. At least good enough to rely on.

Combined with developers often being seen as someone who don't really need to understand the big picture, someone to just make the computers do what the "functional people" have thought out, and very few people ever stopping to think about the human aspect and how people will try to use the system FOR THEIR OWN PURPOSES regardless of what the designers intended, we are fast changing the meaning of GIGO to something much scarier: Garbage in, gospel out! This is scary because by the time I am a pensioner there won't be anyone left who can sit down with pen and paper and show me the calculations so I know I am getting what I am supposed to. Or paying the taxes I should. They will just show me a number on their computer screen and say "see, it's right here!"...

Of course input validation has its place. And I do not have a simple technical solution to this problem that is suitable for packaging as a code project article. So my comment is NOT a criticism of the article per se - it is an attempt to increase awareness that input validation is not always good, and never enough on its own.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.