IPHostEntry IPinfo = Dns.GetHostEntry(textBox1.Text);
foreach (IPAddress IP in IPinfo.AddressList)
{
    textBox2.Text += " " + IP.ToString();
}

解决方案 »

  1.   

    我还有个问题能问你一下吗???这个方法是可以得到ip  那假如我想用网站查询 得到ip呢??例如用ip138.com  怎么实现呢??
      

  2.   

    IPAddress[] ipAddress = Dns.GetHostAddresses("www.sina.com");
                string result = string.Empty;
                ipAddress.ToList().ForEach(x => result += string.Concat("\r\n", x.ToString()));
                Console.WriteLine(result);
      

  3.   

    httpwebrequest.
    http://blog.csdn.net/chenguang79/article/details/3364350
      

  4.   

    httpwebrequest.
    http://blog.csdn.net/chenguang79/article/details/3364350
    我试试看看 谢谢你了