title: UriFormatException: Invalid URI: The hostname could not be parsed. MVC API C#
body: <p>I am trying to create my web application and I want to connect to API. I have base address in my <code>Startup.cs</code> file:</p>
  
  <pre class="lang-cs prettyprint-override"><code>services.AddHttpClient("API Client", client =&gt;
  {
      client.BaseAddress = new Uri("https://icanhazdadjoke.com/");
      client.DefaultRequestHeaders.Add("Accept", "application/json");
  });
  </code></pre>
  
  <p>But now I want to change it in program by adding a <code>/search</code> to the url address. I am using <code>UriBuilder</code> and it looks like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>string responseBody = "";
  var client = _httpClientFactory.CreateClient("API Client");
  var builder = new UriBuilder(client.GetAsync("") + "/search");
  var query = HttpUtility.ParseQueryString(builder.Query);
  query.Add("term", searchedTerm);
  query.Add("limit", jokesPerPage);
  
  builder.Query = query.ToString();
  string url = builder.ToString();
  responseBody = await client.GetStringAsync(url);
  return JsonConvert.DeserializeObject&lt;JokeModel&gt;(responseBody);
  </code></pre>
  
  <p>I got an error:</p>
  
  <blockquote>
    <p>UriFormatException: Invalid URI: The hostname could not be parsed.</p>
  </blockquote>
  
  <p>How can I fix this?</p>