Hi indradeo,
Please refer below sample code.
Namespace
using System.Net.NetworkInformation;
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
long time = PingAddress("www.youtube.com", 1000);
}
}
private static long PingAddress(string address, int timeout)
{
try
{
Ping pingClass = new Ping();
PingReply pingReply = pingClass.Send(address, timeout);
return pingReply.RoundtripTime;
}
catch (Exception e)
{
}
return -1;
}