Check Website is Running...

Results 1 to 3 of 3

Thread: Check Website is Running...

  1. #1
    Join Date
    Dec 1969

    Default Check Website is Running...

    I have the following code in a pageload to check if a certain website is running ok. It is based on a screen scrape, but wondering how you deal with the site returning a 404 error, when it trys to download the data, so that i can report back by email.<BR><BR>I have tried numerous google searches but unable to find anything other than screen scrape ideas.<BR><BR>Any help would be very much appreciated.<BR><BR>Cheers<BR><BR>Dim objWebClient as New WebClient()<BR> Const strURL as String = ""<BR> Dim aRequestedHTML() as Byte<BR><BR> aRequestedHTML = objWebClient.DownloadData(strURL)<BR><BR> Dim objUTF8 as New UTF8Encoding()<BR> Dim strRequestedHTML as String<BR> strRequestedHTML = objUTF8.GetString(aRequestedHTML)<BR><BR> lblHTMLOutput.Text = strRequestedHTML<BR>

  2. #2
    Join Date
    Dec 1969

    Default I'd check the documenation..

    MSDN or the Framework SDK, I&#039;d guess.<BR><BR>Specifically, check to see if you can get at any of the HTTP headers (and specifically the HTTP status).<BR><BR>Or, does that throw an exception that you can catch?<BR><BR>Either way, I&#039;d start w/ the documentation.

  3. #3
    Join Date
    Dec 1969

    Default RE: Check Website is Running...

    Not really sure what a WebClient is in your code.. but you can write your own code using HttpWebRequest and HttpWebResponse.. if the call is success you will get the HTML of the page in your returning stream.. if it is 404, you will get a 404 error msg.. if you get access unauthed you&#039;ll get an exception i think..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts