通过域名获取IP[转帖]
public string GetIPByDomain(string url)
{
if (url.Trim() == string.Empty)
return "";
try
{
System.Net.IPHostEntry host = System.Net.Dns.GetHostEntry(url);
return host.AddressList.GetValue(0).ToString();
}
catch (Exception e)
{
throw e;
}
}
调用方法:
GetIPByDomain("www.it55.com");
转自:http://www.chenjiliang.com/Article/View.aspx?ArticleID=4150&TypeID=84
如果山不向我走来,我就向山走去!
![](http://www.cnblogs.com/Emoticons/baimantou/202015214.gif)