
@byxiaoxie6 年前
03/13
00:03
引用:using System.Net;
/// <summary>
/// 域名转IP
/// </summary>
/// <param name="domain">域名</param>
public static string getIP(string domain)
{
domain = domain.Replace("http://", "").Replace("https://", "");
IPHostEntry host = Dns.GetHostEntry(domain);
IPEndPoint ip = new IPEndPoint(host.AddressList[0], 0);
return ip.Address.ToString();
}