Reputation: 73
I am unable to resolve an address to IP. It is giving an exception "No such host found". But i am able to access the same site through my web browser.
IPAddress address = Dns.GetHostAddresses("https:\\google.com")[0];
Is it because my web browser is using a proxy. How can i still connect to it? i cannot change the proxy setting of the web browser as they are by default in the my company.
Upvotes: 2
Views: 286
Reputation: 210
IPAddress[] ips = Dns.GetHostAddresses("www.google.com");
foreach (IPAddress ip in ips)
{
Console.WriteLine(" {0}", ip);
}
As a test. Works fine.
Upvotes: 0
Reputation: 1080
The problem is that you're including https:\\
. I have tested the code, and it works perfectly when you just use www.google.com
as the parameter for Dns.GetHostAddresses()
.
Upvotes: 2