I'm trying to figure out how to validate that a user has entered matching passwords when they sign up. Is there anything built in to MVC 4 Data Annotations that I can use for this or is the only route creating a custom validation attribute?
If I do have to create a custom validation attribute, how do I access the password property (assuming I put the annotation on the confirm password property)? Also, are there any commonly used libraries for this type of validation?
This is what I have for the beginning of a custom validation attribute, just not sure how to access the password property:
public class CrossFieldValidationAttribute : ValidationAttribute
{
public override bool IsValid(object value) //how do I get the other value in here?
{
//validation logic here
return base.IsValid(value);
}
}
I appreciate any help!