2
我想電子郵件與案件麻木不仁比較ASP.NET MVC3:如何驗證電子郵件[比較]數據註解與不敏感?
[Display(Name = "E-mail *")]
//The regular expression below implements the official RFC 2822 standard for email addresses. Using this regular expression in actual applications is NOT recommended. It is shown to illustrate that with regular expressions there's always a trade-off between what's exact and what's practical.
[RegularExpression("^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", ErrorMessage = "Invalid e-mail.")]
[Required(ErrorMessage = "E-mail must be entered")]
[DataType(DataType.EmailAddress)]
public virtual string Email { get; set; }
[Display(Name = "Repeat e-mail *")]
[Required(ErrorMessage = "Repeat e-mail must be entered")]
[DataType(DataType.EmailAddress)]
[Compare("Email", ErrorMessage = "E-mail and Repeat e-mail must be identically entered.")]
public virtual string Email2 { get; set; }
任何人都知道該怎麼做?例如ToLower()比較。