user1387147
user1387147

Reputation: 955

Get ip address using hostname on the network asp.net

I have deployed an application on the IIS server, as per my requirement i need to get IP-Address of hosted machine which is on the network and i have just host-name of the machine using c# e.g

http://abc

Where abc is deployed on IIS which can be any where on the network i don't know. Is it possible to get IP-Address using this host-name with c#

Upvotes: 3

Views: 1846

Answers (1)

Asif Mushtaq
Asif Mushtaq

Reputation: 13150

Include

using System.Net;

and use

string url = "www.howtogeek.com";
IPAddress[] addresslist = Dns.GetHostAddresses(url);

The following answer also might be helpfule

How to get my own IP address in C#?

Upvotes: 3

Related Questions