Hello folks today I'm going to review ASP.NET 4 validation controls in Visual Studio 2010; first let's explain why we need validation on our web application first.
Why do we need Validation in our web application?
For many reasons, I can't cover all here, but I'll cover most important reasons, which are:
Note: To build secure web application, make sure Validation implemented on client-side and server-side.
Microsoft ASP.NET did a great job to make this easy task on web developer by implement both Server-Side and Client-Side in ASP.NET validation controls; even if you want to implement other client-side framework like jQuery or write your own client-side Javascript validation rules you can disable the client-side validation function in ASP.NET validation control.
First let's examine the validation controls that ASP.NET provides for us:
ASP.NET Validation Controls:
Tip: you can use those Regular Expression cheat sheets to build your custom one. [link][link], or use this Regular Expression builder web app [link]
Second, let's build a sample an ASP.NET web from and implement some validation controls:
First Name:
Last Name:
Email Address:
Age: