Automating Website Testing - Website Online/Available?
<p>I would like to automate some testing of whether a long list of websites is available or not.  I need to test access of certain websites in an intranet.  I just need to basically create an HTTPRequest and send the URL and then read the HTTPResponse (200, 404, 500, etc.) and log the results.  I have some code doing this already and I got a response of 'OK' (a 200).  Is this correct?  Anything else I should be doing?</p>

<pre><code>    try
        {
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(URL);
            webRequest.Method = "GET";
            HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();

            System.Diagnostics.Debug.WriteLine("The response code is: " + webResponse.StatusCode);
            System.Diagnostics.Debug.WriteLine("The response description is: " + webResponse.StatusDescription);
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine("Catch: " + ex.Message);
        }
</code></pre>
