If I am missing something (which is very possible), it seems to me that conventional validation always violated DRY. In all the examples I've seen, even when using the new version of Unobtrusive Client Validation introduced by w / MVC 3, we need to create .NET code for our server-side validation and jQuery (or JavaScript code) for the client-side validation.
I understand that there is no such thing as a .NET-to-jQuery translator that would facilitate a quick check of a DRY server / client, and I assume that this is the only way to have a true DRY check that works both on the server side and on the client side.
But I would be completely pleased that a user check was always performed on the server. The data needed to go to user verification (in my case) is usually limited to one or two fields, and the server-side logic is usually pretty fast, even if it gets into the database.
Is there an OOTB mechanism for connecting custom validation using attributes, and then client-side validation uses Ajax to perform server-side validation and client response? Or did anyone come up with such a solution?
Or is this a question, after all, the tradeoffs of repeating a user check are better than the problems that arise with / always performing the user side of validation?
Thanks in advance.
validation asp.net-mvc dry asp.net-mvc-3
Jerad rose
source share