get host name from ip address in vb.net

To get the host name from IP address in VB.NET you can use Request object or System.Net class here is a function to return host name from IP address.

Get Client IP Address
Request.UserHostAddress

Get Client Host Name
Request.UserHostName

Function to get host name from IP address

Public Function Get_Host_By_Address(ByVal IP_Address As String) As String
        Dim host As System.Net.IPHostEntry
        Try
            host = System.Net.Dns.GetHostEntry(IP_Address)
            Return host.HostName
        Catch ex As Exception
            Return ""
        End Try
End Function




Add Comments

Name: *
Email: *
URL:
Comments: *