title: How to get result from failing webclient.downloadstring?
body: <p>If we use webclient.downloadstring on a server with error, we got nothing</p>
  
  <pre><code>        Try
              result = webClient.DownloadString("https://api.bodis.com/domainclassification?domain=" + CurrentBlog.Domain)
          Catch ex As Exception
              System.Windows.Forms.Application.DoEvents()
          End Try
  </code></pre>
  
  <p>Usually result contains the response. But in case of error result is empty.</p>
  
  <p>I want to know something. For example, even if the result is bad, usually there is a custom 404 message, etc.</p>
  
  <p>The api.bodis.com is problematic because it mix secure and non secure stuff. However, it gives output anyway in internet explorer. I want to use webclient and I want to know the ouput</p>
  
  <p>Getting ex.response yields nothing</p>
  
  <pre><code>        Dim adult = webClient.DownloadString("http://googleads.g.doubleclick.net/apps/domainpark/domainpark.cgi?callback=_google_json_callback&amp;output=js&amp;client=ca-dp-godaddy2_xml&amp;domain_name=" + CurrentBlog.Domain)
          'ias.NavigateTillComplete("https://api.bodis.com/domainclassification?domain=" + CurrentBlog.Domain)
          Dim result = ""
          Dim url = "http://api.bodis.com/domainclassification?domain=" + CurrentBlog.Domain
          Dim webRequest = DirectCast(System.Net.HttpWebRequest.Create(url), System.Net.HttpWebRequest)
          Dim response As HttpWebResponse
          Try
              response = DirectCast(webRequest.GetResponse(), HttpWebResponse)
          Catch ex As System.Net.WebException
              System.Windows.Forms.Application.DoEvents()
              response = DirectCast(ex.Response, HttpWebResponse) 'is nothing there
          End Try
  
          Dim responseStream = response.GetResponseStream
  </code></pre>