基于域名的电子邮件地址验证
答
您应该使用MailAddress
类:
MailAddress address = null;
try {
address = new MailAddress(str);
} catch(FormatException) {
//Invalid address
}
if (!address.Host.Equals("microsoft.com", StringComparison.OrdinalIgnoreCase) {
//Bad domain
}
感谢我怎么这个功能在MVC与数据注解连接到典型的模式? – Francesco 2011-01-23 22:03:24