Send a Ping from an ASP.NET Web Page
By Peter Bromberg
Here's how to make a "Ping" page. All you need is a textbox and a button, and a label to display the result.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Ping
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
var x= ping.Send(TextBox1.Text);
this.Label1.Text = x.Status + ": " + x.RoundtripTime;
}
}
}
Send a Ping from an ASP.NET Web Page (1697 Views)