//you could use either ip or hostname var ip = "127.0.0.0"; var hostname = "hostname.com"; Ping pinger = new Ping (); byte[] buffer = Encoding.ASCII.GetBytes ("test123"); int timeout = 60; PingReply reply = pinger.Send (ip, timeout, buffer); if (reply.Status == IPStatus.Success) { //hooray }else{ //nope }
try{ HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "HEAD"; HttpWebResponse response = request.GetResponse() as HttpWebResponse; WebHeaderCollection headers = response.Headers; //hooray }catch(Exception ex){ //nope }
WebClient client = new WebClient (); string reply = client.DownloadString ("www.google.com");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)