[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

Ipaddress.address -> ip format 255.255.255.255

How do I get an ip format of 255.255.255.255 from

IPHostentry iph = Dns.Resolve(hostname.com);
string a = iph.AddressList[0].Address.ToString(); // gives me a long number, how do i get the above format?
0
addicktz
Asked:
addicktz
  • 2
  • 2
2 Solutions
 
SmithJWCommented:
use this instead, the functions you have attempted to use are deprecated:

IPHostEntry iph = Dns.GetHostEntry("hostname.com");
string a = iph.AddressList[0].ToString();
0
 
AdGrootCommented:
if you use dotnet framework 2.0 use this  


          foreach (IPAddress adr in Dns.GetHostAddresses("localhost"))
            {
                MessageBox.Show(adr.ToString());
            }

Dns.GetHostEntry("hostname.com"); is obsolute in framework 2.0

Ad
0
 
SmithJWCommented:
I'm using framework 2.0
I didn't get any messages that it was obsolete, but I didn't check, both methods work though :)
0
 
AdGrootCommented:
Sorry

I was wrong, made a copy error

Dns.Resolve(hostname.com); this one was obsolute

Ad
 
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now