tags:

views:

85

answers:

2

My scenario:

When i ping with www.google.com it give the status Success, When i try to ping http://stackoverflow.com i got an exception "An exception occurred during a Ping request." What is the reason? how can i solve?

using (Ping png = new Ping())
{
  PingReply pr = png.Send("http://stackoverflow.com");
  string status= pr.Status.ToString();
}
+6  A: 

Don't include the HTTP://, then it works fine.

Joachim VR
+1 - ping works with _domains_, not URIs.
Oded
Yes, HTTP:// just tells the browser what protocol to use, like HTTPS:// or FTP://
Joachim VR
+2  A: 

As Joachim said, drop the protocol. If you read the documentation ( http://msdn.microsoft.com/en-us/library/7hzczzed.aspx ) you'd be aware that the ping object wants a host name or address, not a URI.

Rushyo