根据域名取IP地址,碰到了一个问题
这是我的方法:
public string GetIPByDomain(string domain) { try { IPHostEntry host = System.Net.Dns.GetHostEntry(domain.Trim()); return host.AddressList.GetValue(0).ToString(); } catch { } return "DNS出错";GetIPByDomain("flsjflsjflsjflsjflsjfls59394573957oeworwuoruwlfjlsf.com")