Validation Application block VS ASP.NET Validation controls

Topics: Validation Application Block
Apr 27, 2009 at 1:07 PM

I have gone through the exercise provided with Enterprise Library 4.1 Hands on labs.

I could not understand the purpose of Validation block especially with in ASP.NET apps.

Microsoft has already provided Validation controls to use such as Required Filed validator etc.

I can not see any advantage of using Validation Block within my ASP.NET applicaiton.

please correct me if I get this wrong...

Apr 28, 2009 at 2:20 AM
The Validation block is not only meant for applications but for console and winforms app as well (where you can't use validation controls of course).  Another advantage is well, it provides much more built-in validators than's such as the domain validator, composite validators, object collection validator, etc (refer to the documentation).  It's also much more flexible because if none of those validators meets your requirement, you can create your own custom validator.  The disadvantage I can say is that it doesn't provide client-side validation. 

But all in all, VAB is very easy to use.  It's not also just for validation on the UI side but it allows you to validate object types.  You can also integrate it with Policy Injection Application Block to apply validation policies within your app. 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
Apr 28, 2009 at 8:30 AM
Yes Sarah. I agree with you.

After going through Enterprise Library 4.1 Handsd on Lab Exercise 12, 

I think creating Domain Classes is required to use Validation Application Block , which in turn requires us to write classes with few lines of code.

I would stick to ASP.NET Validation Controls provided rather than using VAB for Web apps.

Reasons that put me down ( not considering VAB) are:

  • Requires Domain Classes
  • No Client side validation support
  • It is quite feasible write Custom validators in ASP.NET as well.

Thank you for your information. It has helped me alot in my VAB investigation.