VB网站的2008 IP地址? [英] vb 2008 ip address of website?

查看:61
本文介绍了VB网站的2008 IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有人可以告诉我如何找到网站的IP地址而不是我的本地IP吗?

我有以下代码:

Hi,

Can someone tell me how I can find the IP address of a website instead of my local IP?

i have the following code:

Try
           Dim ipEntry As IPHostEntry = Dns.GetHostByName(TextBox3.Text)
           Dim IpAddr As IPAddress() = ipEntry.AddressList

           TextBox3.Text = IpAddr(0).ToString()
           Dim hostname As IPHostEntry = Dns.GetHostEntry(TextBox3.Text)
           Dim ip As IPAddress() = hostname.AddressList
           TextBox3.Text = ip(0).ToString()
       Catch ex As Exception
       End Try



这会继续在"TextBox3"中显示我自己的IP地址.

我想知道的是,如果用户在"TextBox1"中写入"www.website.com",我如何要求vb去获取"www.website.com"的IP地址并显示在"TextBox3"中?

预先感谢您提供的任何帮助.



This keeps bringing up my own IP address in ''TextBox3''.

What I want to know is, if the user writes ''www.website.com'' in ''TextBox1'' how can I ask vb to go and get the IP address of ''www.website.com'' and display in ''TextBox3''?

thanks in advance for any help given

推荐答案

实际上,您拥有的代码很好,您似乎已经完成了. 前三行似乎工作正常(尽管GetHostByName已过时).然后,请第二三行来解析失败的IP地址.您需要的是:
Actually the code you have is good you just seem to have over done it.
The first 3 lines seem to work fine (Although GetHostByName is obsolete). Then you ask the second 3 lines to resolve an IP address which fails. All you need is:
Dim hostname As IPHostEntry = Dns.GetHostEntry(TextBox3.Text)
Dim ip As IPAddress() = hostname.AddressList
TextBox3.Text = ip(0).ToString()


这篇关于VB网站的2008 IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆