public class SitePinged : System.Web.Services.WebService {
public SitePinged () {
//如果使用設計的元件,請取消註解下行程式碼
//InitializeComponent();
}
[WebMethod]
public string Ping(string site)
{
Ping wsPing = new Ping();
PingReply wsPingReply = wsPing.Send(site);
return wsPingReply.Status.ToString();
}
}
星期六, 10月 02, 2010
[Asp.Net] Pinging using asp.net
要使用ping類別之前,需引入using System.Net.NetworkInformation;
訂閱:
意見 (Atom)