in MVC3 you can add validation to models to check if properties match like so:
public string NewPassword { get; set; }
[Compare("NewPassword",
ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
Is there a way to check that two properties differ like in the following make-believe code?
[CheckPropertiesDiffer("OldPassword",
ErrorMessage = "Old and new passwords cannot be the same")]
public string OldPassword { get; set; }
public string ConfirmPassword { get; set; }
Here is what you could use in the model:
And then define the following custom attribute: