Data Annotation to validate confirm password
问题 My User model has these data annotations to validate input fields: [Required(ErrorMessage = "Username is required")] [StringLength(16, ErrorMessage = "Must be between 3 and 16 characters", MinimumLength = 3)] public string Username { get; set; } [Required(ErrorMessage = "Email is required"] [StringLength(16, ErrorMessage = "Must be between 5 and 50 characters", MinimumLength = 5)] [RegularExpression("^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$", ErrorMessage = "Must be a valid email")]