Reputation: 11
I was using [MaxLength(value)] for view model Email address field with [EmailAddress] attribute. And found that email's with value+1 characters path validation process.
Upvotes: 1
Views: 68
Reputation: 44680
Try StringLength attribute for this purpose.
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
public string Email{ get; set; }
Upvotes: 1