My User model has these data annotations to validate input fields:
[Required(ErrorMessage = \"Username is required\")]
[StringLength(16, ErrorMessage = \"Must be
Other data annotations are optional you can add those according to your requirement but you need to do this to implement password comparison operation
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
[Required]
[DataType(DataType.Password)]`enter code here`
[Compare("Password")]
public string ConfirmPassword { get; set; }