title: "remote name could not be resolved" exception when trying to download response using .NET WebClient
body: <p>I am trying to download a response from a certain website in order to confirm the site is up and to measure the response time (which is provided in the site content)</p>
  
  <p>The page has url like <code>https://www.blabla.com.au/ServiceAvailability</code></p>
  
  <p>I can put in the page url in my browser and I can see the page is up and response time provided. I can also click the link and the page will load in the visual studio browser as well.</p>
  
  <p>But when I try to call the same url from my application I get the following <code>System.Net.WebException</code>:</p>
  
  <blockquote>
    <p>{"The remote name could not be resolved: "www.blabla.com.au"}</p>
  </blockquote>
  
  <p>The code is running on my local PC, I am also accessing the website from my local PC and can bring up the page from the browser and in VS</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>string myUrl ="https://www.blabla.com.au/ServiceAvailability";
  
  using (WebClient webClient = new WebClient())
  { 
      result = webClient.DownloadString(myUrl);
  }
  </code></pre>
  
  <p>where <code>result</code> is a <code>string</code></p>
  
  <p>I have tried the following to get around the problem:</p>
  
  <ol>
  <li>Run visual studio as an administrator</li>
  <li>Use my user name/ password as credentials instead of the default</li>
  <li>Put an @ infront of the url</li>
  <li><p>Tried using WebRequest and HttpWebRequest as per code blocks below:</p>
  
  <pre><code>WebRequest req = WebRequest.Create(myUrl);
  res = req.GetResponse();
  
  HttpWebRequest req = WebRequest.Create(myUrl) as HttpWebRequest;
  HttpWebResponse res = req.GetResponse() as HttpWebResponse;
  </code></pre></li>
  </ol>