Exforsys

H I D E

Home arrow Technical Training arrow ASP.NET Training

ASP .NET: Validating User Input with C#

Page 1 of 7
Author : Exforsys Inc.     Published on: 4th Mar 2005    |   Last Updated on: 18th Dec 2010

This tutorial covers Validating User Input with C# covers Overview of ASP.NET Validation Controls , Using the Simple Validators , Using the Complex Validators and Summarizing Results with the Validation Summary Control.

In this tutorial we will see the validation controls. The purpose of the validation controls is to validate the user input. Asp.net provides the developer with different types of validation controls. One most important point to note is that the validation is done on the client side as well as on the server side. You can always turn the validation on the client side off using the enable client side property to false. Lets see the difference between the client side validation and the server side validation.

Client side validation

When you place validation code on the client side, validation does not require a postback operation and provides fast responses to the user. However, because the validation code is outside the Web Server, it might be possible for the client to spoof the Web Server with invalid data. The addition to this, client-side validation requires the client to be capable of running scripts. That might be an issue with old browsers and some new browsers in which users turn off script execution thinking that scripts are unsafe. This client-side validation should never be used as the only validation technique to validate data on a Web page.

Server Side Validation

When the validation code is placed the server side, the process of validation might be slow because a form might involve multiple roundtrips to the Web Server before all the data is validated. On the other hand, because the Web Server is performing all the validation, you can trust the validated data. Server-side validation works well with even primitive browsers because it does not assume any specific browser capabilities.

(MCAD/MCSD Developing and implementing Web Applications with Visual C# .NET and Visual Studio. NET)

Read Next: Using Rich Server Controls with C#


 
This tutorial is part of a ASP.NET Training tutorial series. Read it from the beginning and learn yourself.

ASP.NET Training

 

Comments