A number of questions have been asked on this topic before, but since ASP.NET MVC is moving quite fast I wanted to re-ask the question:

What would you recommend for providing form input validation in ASP.NET MVC?


  • Server-side checking
  • Client-side (JavaScript) checking
  • Should cover the basics such as mandatory fields, numeric range validation, regex validation

(So basically all (or most) of the stuff that the ASP.NET WebForms validation controls do)

Current options seem to be:

  1. Validator Toolkit on CodePlex
  2. Jumping to ASP.NET MVC 2 Preview 1 (Our application is for internal use and go-live is in 6 months, so we might be comfortable using the preview)
+7  A: 

xVal should be good choice in your case.

Dmytrii Nagirniak
+1- good choice.
Unfortunately last version update was in Feb 2009.
Alexander Prokofyev
I guess Steven Sanderson was bussy in the meantime writing his book. Hopefully he will continue to work on xVal.
Malcolm Frexner
I don't think that is an issue.It does most of the work every developer would expect. So there probably is no need to change it every week or so.Anyway, you still have the code and can modify to suit your needs.
Dmytrii Nagirniak
+2  A: 

I would use DataAnnotations, is going to be a part of MVC but can be compiled and used in 1.0.


I don't like Buddy Classes - they violate DRY:
Rather than using buddy classes we have a set of ViewModel classes that map to our back-end data models (typically these come from a WCF proxy class). We map the properties using AutoMapper (
Richard Ev
Can you cite an article that indicates that DataAnnotations are going to be an official part of ASP.NET MVC? The article you link to indicates that they are not "official".
Richard Ev
+2  A: 

FluentValidation also has an MVC component, however it doesn't do the client side of things. Ideally this could be integrated with xVal.

That's a good one. I didn't know it exists and wanted to implement it myself.
Dmytrii Nagirniak
I've just been looking at it myself, and there is actually an existing xValIntegration in the FluentValidation project. It's not complete, but makes a good start.