ASP.NET: Get Client IP Address

    Private Function GetIPs() As StringCollection
        Dim localIP = New StringCollection()
        Dim localHostName = Dns.GetHostName()
        Dim hostEntry = Dns.GetHostEntry(localHostName)
        For Each ipAddr As IPAddress In hostEntry.AddressList
            localIP.Add(ipAddr.ToString())
        Next
        GetIPs = localIP
    End Function

No comments:

Post a Comment