Testing Web Sites with HttpWebRequest
By Eric Smith:
Introduction:
As a third type of verification, I check certain Web sites to make sure that the server is up, running, and not generating any Web errors. In some cases, Microsoft's Web server produces a Web page even if it has an error. If you don't check the content of that page, it might look as though the server is actually up and running. As a result, I also have a type of check that simulates a browser visiting the page and reading the content. I use the HttpWebRequest and HttpWebResponse classes, as well as some other network I/O code.