最新.net2.0获取本机IP等信息

为了得到Client电脑的信息,我在网上搜了很多关于怎样获取客户端信息的资料,但都没有一个能在VS.NET2005下能编译通过的,后来自己琢磨出来了,如下:

Public Function getUserHostAddress() As String
        If strUserHostAddress = "" Then
            Dim name As String = Dns.GetHostName()
            Dim entry As IPHostEntry = Dns.GetHostEntry(name) '跟net1.1是有区别的
            strUserHostAddress = entry.AddressList(0).ToString()
        End If
        Return strUserHostAddress
    End Function

posted @ 2006-09-11 10:25  丹心猪(Dansinge)  阅读(284)  评论(0)    收藏  举报