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());
    }

posted @ 2009-05-08 15:58  jianlinglo  阅读(669)  评论(0编辑  收藏  举报