title: Getting Http Status code number (200, 301, 404, etc.) from HttpWebRequest and HttpWebResponse
body: <p>I am trying to get the HTTP status code number from the <code>HttpWebResponse</code> object returned from a <code>HttpWebRequest</code>.  I was hoping to get the actual numbers (200, 301,302, 404, etc.)  rather than the text description. ("Ok", "MovedPermanently", etc.)  Is the number buried in a property somewhere in the response object?  Any ideas other than creating a big switch function?  Thanks.   </p>
  
  <pre><code>HttpWebRequest webRequest = (HttpWebRequest)WebRequest
                                             .Create("http://www.gooogle.com/");
  webRequest.AllowAutoRedirect = false;
  HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
  //Returns "MovedPermanently", not 301 which is what I want.
  Console.Write(response.StatusCode.ToString());
  </code></pre>