I have added the below custom data annotation validation in my code for my text area (to allow only valid email IDs)
 public class ValidateEmails : ValidationAttribute
{
    protected override ValidationResult IsValid(object value, ValidationContext validationContext)
    {
        if (value != null)
        {
            string[] commaLst = value.ToString().Split(',');
            foreach (var item in commaLst)
            {
                try
                {
                    System.Net.Mail.MailAddress email = new System.Net.Mail.MailAddress(item.ToString().Trim());
                }
                catch (Exception)
                {
                    return new ValidationResult(ErrorMessage = "Please enter valid email IDs separated by commas;");
                }
            }
        }
        return ValidationResult.Success;
    }
}
Model:
 public class BuildModel
{
    public Int64 ConfigID { get; set; }
    [Required(ErrorMessage = "Please select a stream!")]
    public string StreamName { get; set; }
    [Required(ErrorMessage = "Please select a build location!")]
    public string BuildLocation { get; set; }
    public string Type { get; set; }
    public bool IsCoverity { get; set; }
    [ValidateEmails(ErrorMessage = "NOT VALID !!!")]
    public string EmailIDsForCoverity { get; set; }
   }
When I run my app and enter an invalid string in the text area, the breakpoint hits inside the validation. But however, the submit action goes on to happen.
Actually, I have a bootstrap modal form, within which I do the validation. On click of submit button, the inbuilt custom validations like 'Required' work well. However, my custom data annotation validation won't work. What wrong am I doing here?
 
     
     
    