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();
}
Hold down the Windows key and the R key at the same time to open the Run Prompt window, type "cmd" into the bar, then click OK or press Enter. In the Command Prompt window, type "ping" followed by the destination — either an IP address or a domain name, then press Enter.
-c. Specifies the number of packets. This option is useful when you get an IP trace log. You can capture a minimum of ping packets.
It means that your ICMP packet (ping) was silently discarded with no response sent. That might happen for several reasons: Ping is disabled on router or (more likely) end point. Network is congested or misconfigured.
(In case you have heard the term HTTP, it is a protocol which is one layer up from ICMP or TCP.) What this means is that any router or firewall between you and the server you try to ping may just block your pings. Pinging a server is not a reliable way to see if it is up.
Don't include the HTTP://, then it works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With