We have answer of your question!

100% solved queries, no empty question

Question: Getting the Remote Name Address (not IP)


0

Advertisement


I wanted to show the users Name Address (see www.ipchicken.com), but the only thing I can find is the IP Address. I tried a reverse lookup, but didn't work either:

IPAddress ip = IPAddress.Parse(this.lblIp.Text);
string hostName = Dns.GetHostByAddress(ip).HostName;
this.lblHost.Text = hostName;

But HostName is the same as the IP address.

Who know's what I need to do?

Thanks. Gab.

Question author Gabri%c3%abl | Source

Answer


1


Advertisement


Edit of my previous answer. Try (in vb.net):

    Dim sTmp As String
    Dim ip As IPHostEntry

    sTmp = MaskedTextBox1.Text
    Dim ipAddr As IPAddress = IPAddress.Parse(sTmp)
    ip = Dns.GetHostEntry(ipAddr)
    MaskedTextBox2.Text = ip.HostName

Dns.resolve appears to be obsolete in later versions of .Net. As stated here before I believe the issue is caused by your IP address not having a fixed name or by it having multiple names. The example above works with Google addresses, but not with an address we use that has a couple of names associated with it.

Answer author Seanyboy

Advertisement


Tickanswer.com is providing the only single recommended solution of the question Getting the Remote Name Address (not IP) under the categories i.e .net , asp.net , . Our team of experts filter the best solution for you.

You may also add your answer!