Handle Web Exception raised from HttpWebRequest in C#

The HttpWebRequest and HttpWebResponse classes from the .NET Base Class Library make it easy to access Internet resources through a request/response model. The Httprequest object identifies the Web page to get and contains a GetResponse() method for obtaining a HttpWebResponse object. With a HttpWebResponse object, we retrieve a stream and extract page information using stream operations.