vb.net获取网站的IP地址怎么实现?
比如,我想获取类似下面网址的IP地址,应该如何实现呢?
http://community.csdn.net/Expert/topic/5329/5329044.xml?temp=.6499292
[解决办法]
先用 "community.csdn.net " 实例化一个HttpWebRequest对象,然后从HttpWebResponse里拿ip地址.
[解决办法]
Imports System.Net
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim hostNameOrAddress As String
Dim returnValue As IPAddress()
hostNameOrAddress = "community.csdn.net "
returnValue = Dns.GetHostAddresses(hostNameOrAddress)
Me.Text = returnValue(0).ToString
End Sub
End Class
[解决办法]
snto(神中神) 的代码是正确的