ASP.NET中实现ping(调试)
添加引用:Microsoft.VisualBasic
前台:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
后台:
protected void Button1_Click(object sender, EventArgs e)
{
Microsoft.VisualBasic.Devices.Computer com = new Microsoft.VisualBasic.Devices.Computer();
bool result = com.Network.Ping(TextBox1.Text);
Response.Write("ping " + TextBox1.Text + "结果:" + result.ToString());
}