views:

355

answers:

1

Suppose I am retrieving a url as follows:

string url = "http://www.somesite.com/somepage.html"
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

Is there a way I can see the IP address of the destination url? Does it require a separate call?

Thanks

A: 

Look at the System.Net.Dns class. You can get a list of IP addresses of the host from the Dns.GetHostEntry() method.

nasufara