title: How can I resolve a "NameResolutionFailure" error when trying to gather data from every type of internet connection?
body: <p>I am currently using <code>Httpclient</code> and I can successfully gather my data with a specific network/internet-connection at the place that has the data. </p>
  
  <p>However when I try to gather the data at home with another internet-connection I receive an "NameResolutionFailure" error.</p>
  
  <p>My goal is to be able to reach the data from any type of connection but I am not sure what I am quite missing here. (I am also new in this area).</p>
  
  <p>This is the code that I use when I talk to the db:</p>
  
  <pre><code> string dataurl = "my-url-here";
  
   var http = new HttpClientHandler()
   {
       Credentials = new NetworkCredential("user", "password", "domain"),
   };
  
   var httpClient = new HttpClient(http);
  
   try
   {
       var result = await httpClient.GetStringAsync(dataurl);
       System.Diagnostics.Debug.WriteLine(result);
   }
  
   catch (HttpRequestException ex)
   {
       if (ex.GetBaseException() != null)
       {
  
       System.Diagnostics.Debug.WriteLine(ex.GetBaseException().Message); //this is where i recieve the NameResolutionFailure error
       }
       else
       {
       System.Diagnostics.Debug.WriteLine(ex.Message);
       }
    }
  </code></pre>
  
  <p>How come I can only reach the data when I am on a certain network and not with every network? Am I missing code or is there something else in play here? </p>
  
  <p>Appreciate every help, tips, code-examples i can get!</p>