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: *
 


Advertisements

MySQL HOSTING
MySQL hosting provider, clustering and replication supported. DBA Services Included.

SQL SERVER HOSTING
Reliable, powerful SQL Server 2008 hosting with ASP.NET on Windows 2008 Servers.

SQL Server DBA

I am a SQL Server DBA with almost 9 years of experience in database technologies.

 I am again in process of redesigning this website using ASP.NET 2.0 and AJAX. The main purpose of new SQL DBA website is to offer more features and make it easy for me to update contents on regular basis.