HTTP Status Code in case of Exception
This is how to get HTTP Status code in case of an Exception during HttpWebRequest
catch(WebException ex)
{
HttpWebResponse res = (HttpWebResponse) ex.Response;
Console.WriteLine("Http status code: " + res.StatusCode);
}