The importance of validating input data

Creating and running an application in isolation mode makes your application run without any issues. However, when working on a real project, your application will be executing in an environment where many external interfaces may interact. In such scenarios, is your application capable of handling such communications? Can it handle all kinds of data from these external applications? There will be many users who will try to use your system; some may use it properly, and others may try to break your system. Can your application tolerate such interactions?

There may be problems with both types of user. Those who use your system properly may make mistakes by entering incorrect data or may forget to provide the requisite data. In the event your application has logic based on the user's date of birth and the user enters some text data, your application might throw an exception and crash. 

In a scenario where users try to break your application by providing data that doesn't match any of the types that your application expects, this may crash your application and a significant amount of time may be devoted to recovering it. 

Any of these aforementioned actions can cause temporary damage to your application or may constitute a major issue. When it corrupts your database, recovering your application may entail more time and effort.

Creating an application using .NET Framework involves the provision of some built-in features that can be utilized to validate some of the input data, be it from internal or external users or external applications. Framework allows you to add attributes over each property that can validate data for you. These are available when you use ASP.NET or the Entity Framework, and so on. As you learned in previous chapters, you can define custom attributes and perform validation on the data entered by users. 

In the next section, we will see a variety of data integrity scenarios that are important to understand while working on data validations in your applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.251.128