Click here to Skip to main content
12,757,627 members (36,778 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
Hi

How to convert server URL IP Address to Domain name in asp.net,c#?
Posted 22-Jan-13 0:23am
24983793
Comments
Nandakishorerao 22-Jan-13 5:32am
   
you have to configure in IIS..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Which one? A number of domains can be hosted from a single IP address.

You can try this:
IPAddress url = IPAddress.Parse("2.100.56.197");
            IPHostEntry iphe = Dns.GetHostEntry(url);
            Console.WriteLine(iphe.HostName);
But there is a good chance it won't work in a lot of cases.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Please review the following link


www.sourcecodester.com/article/net/converting-domain-names-ip-addresses.html[^]

I think this is what you are looking for.

Happy Programming
  Permalink  
Comments
santhosh19783 22-Jan-13 5:37am
   
in my page,
I have one link in mail ...that i click link and throw
"Warning! It appears that you are about to access a website that has non-standard web address format. Such sites may contain harmful entities such as viruses. We recommend you use extreme caution."
I have read answer in googled:
t looks like the email client or web browser thinks that your link is illegitimate because it is an IP address. A lot of spammers uses IP addresses without a mapped domain name, thus showing a message to warn users that it may link to a harmful site

Plz tell me ansmwerif u know
Zafar Sultan 22-Jan-13 6:46am
   
can you share the link?
santhosh19783 23-Jan-13 1:21am
   
I checked local host and server ip address LocalHost: "href="http://localhost:58543/Jobs/ViewJob.aspx?cid=Uct9nEQkA2w%3d-MTY%3d&id=yz2KAMX1DOA%3d-NDY%3d">Click here" For Example Server URL: "href="http://22.234.572.1/Jobs/ViewJob.aspx?cid=Uct9nEQkA2w%3d-MTY%3d&id=yz2KAMX1DOA%3d-NDY%3d">Click here" Both url i checked and throw warning message is ""Warning! It appears that you are about to access a website that has non-standard web address format. Such sites may contain harmful entities such as viruses. We recommend you use extreme caution."" Please guid me... Thanks in advance
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

// Get Ip Address from DomainName
static void GetIPAddress(string hostname)
{
    IPAddress[] ipAddr = Dns.GetHostAddresses(hostname);
    Console.WriteLine("GetHostAddresses({0}) :", hostname);

    foreach (IPAddress ip in ipAddr)
    {
        Console.WriteLine(ip);
    }
}

// Get HostName from IPAddress
static void GetDomainName(string ipaddress)
{
    IPHostEntry hostEntry = Dns.GetHostEntry(ipaddress);
    Console.WriteLine("DNS name : " + hostEntry.HostName);

    //Aliases if any
    String[] aliases = hostEntry.Aliases;
    for (int i = 0; i < aliases.Length; i++)
    {
        Console.WriteLine("Alias: " + aliases[i]);
    }
}



You can also check ip adderess from domain name and domain name from ip address from this site WhoisXY.com
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

a complete solution your problem on this site..check out this linkhttp://www.sourcecodester.com/article/net/converting-domain-names-ip-addresses.html[^].
  Permalink  
Comments
SoMad 21-Dec-13 17:24pm
   
This is just a repost of Solution 1.

Soren Madsen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 21 Dec 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100