code_junkie

what is the best way to verify if a website is working

Nov 14th, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(serverUrl);
  2. System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
  3.  
  4. if (response.StatusCode == System.Net.HttpStatusCode.OK)
  5. {
  6. response.Close();
  7. return true;
  8. }
  9.  
  10. if ( new System.Net.WebClient().DownloadString(" url here ").Length > 0 )
  11. {
  12. // ...
  13. }
Add Comment
Please, Sign In to add comment