.Net通過(guò)域名獲取服務(wù)器IP地址
C#通過(guò)域名即可獲取服務(wù)器IP地址
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net; namespace AutoHome.Net { public partial class GetIP : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //.通過(guò)域名獲取服務(wù)器IP地址 IPAddress[] IPs = Dns.GetHostAddresses("www.baidu.com"); foreach (IPAddress ip in IPs) { Response.Write(ip.ToString() "<br>"); } } } }
原文鏈接:.Net通過(guò)域名獲取服務(wù)器IP地址