title: C# httpClient does not return content
body: <pre><code>public const string CloudApi = "https://www.idxhome.com/restServices/cloud-idx/login";
  public const string password = "cloudidx";
  public const string clientId = "65912";
  public async Task&lt;ActionResult&gt; Index()
  {
      HttpClient client = new HttpClient();
      client.BaseAddress = new Uri(CloudApi);
      client.DefaultRequestHeaders.Accept.Clear();
  
      var values = new Dictionary&lt;string, string&gt;
      {
         { "clientId", "cloudidx" },
         { "password", "65912" }
      };
  
      var content = new FormUrlEncodedContent(values);
      HttpResponseMessage response =  await client.PostAsync(CloudApi,content);
  
      if (response.IsSuccessStatusCode)
      {
          var responseString = response.Content.ReadAsStringAsync().Result;
  
          response.Content.ToString();
      }
  
      client.Dispose();
  
      return View();
  }
  </code></pre>
  
  <p>I have tried using HttpWebRequest as well as httpClient. 
   I have looked through a dozen or so question on here and none of them have helped the situation. </p>
  
  <p>I can use PHP and Curl and get the result I am looking for. The data returned in PHP is a JSON list of links. That looks like this..</p>
  
  <pre><code> "links":[
       {
          "rel":"search",
          "href":"http://www.idxhome.com/restServices/cloud-idx/client/2/listing-search/MTM4NDMwMDg2MTA3ODoxYjExMWVhNDVlYWVmMjdiOTZhNTE5NjBhMjU3YzYzMzNhZmI0MzkwODk2MmExY2U0NU0ZjFiOGE3YzFhMTU4MjYxNjNlZjNhYjF-hZWFmNDI2ZWE3NmQwMjE4ODdjNmMzNGQxZmIxYTE4MGQ2MjUyM2YZWNhYjAwM2Q5MWFmNzgyYzM3NzcwYzFmNDk5OGM1Y2ExNDZhYjQwMDk2OWI4NmFhYTllZj..."
       },
       {
          "rel":"detail",
          "href":"http://www.idxhome.com/restServices/cloud-idx/client/2/listing-search/MTM4NDMwMDg2MTA3ODoxYjExMWVhNDVlYWVmMjdiOTZhNTE5NjBhMjU3YzYzMzNhZmI0MzkwODk2MmExY2U0NU0ZjFiOGE3YzFhMTU4MjYxNjNlZjNhYjF-hZWFmNDI2ZWE3NmQwMjE4ODdjNmMzNGQxZmIxYTE4MGQ2MjUyM2YZWNhYjAwM2Q5MWFmNzgyYzM3NzcwYzFmNDk5OGM1Y2ExNDZhYjQwMDk2OWI4NmFhYTllZj..."
       },
       {
          "rel":"cities",
          "href":"http://www.idxhome.com/restServices/cloud-idx/client/2/listing-search/MTM4NDMwMDg2MTA3ODoxYjExMWVhNDVlYWVmMjdiOTZhNTE5NjBhMjU3YzYzMzNhZmI0MzkwODk2MmExY2U0NU0ZjFiOGE3YzFhMTU4MjYxNjNlZjNhYjF-hZWFmNDI2ZWE3NmQwMjE4ODdjNmMzNGQxZmIxYTE4MGQ2MjUyM2YZWNhYjAwM2Q5MWFmNzgyYzM3NzcwYzFmNDk5OGM1Y2ExNDZhYjQwMDk2OWI4NmFhYTllZj..."
       },
       {
          "rel":"zips",
          "href":"http://www.idxhome.com/restServices/cloud-idx/client/2/listing-search/MTM4NDMwMDg2MTA3ODoxYjExMWVhNDVlYWVmMjdiOTZhNTE5NjBhMjU3YzYzMzNhZmI0MzkwODk2MmExY2U0NU0ZjFiOGE3YzFhMTU4MjYxNjNlZjNhYjF-hZWFmNDI2ZWE3NmQwMjE4ODdjNmMzNGQxZmIxYTE4MGQ2MjUyM2YZWNhYjAwM2Q5MWFmNzgyYzM3NzcwYzFmNDk5OGM1Y2ExNDZhYjQwMDk2OWI4NmFhYTllZj..."
       }
    ],
  "cloudIdxSearchProfile":{
      "bedrooms":2,
      "cityId":"274,284",
      "fullBaths":1,
      "lotAcres":0,
      "maxListPrice":1000000,
      "minListPrice":0,
      "newConstructionYn":false,
      "openHomesOnlyYn":false,
      "propertyType":"SFR,CND",
      "squareFeet":0,
      "zip":"94702,94703"
  },
  "cloudIdxDetailProfile":{
      "listingNumber":"88873733",
      "boardId":6
  },
  "message":"Include 'idxCloudSearchProfile' url parameters with requests to the 'search' URL. For 'detail' requests, include 'idxCloudDetailProfile' url parameters."`
  </code></pre>
  
  <p><a href="http://support.ihomefinder.com/index.php?/Knowledgebase/Article/View/175/56/technical-details" rel="nofollow noreferrer">API I am trying to utilize</a>. It logs in with success but i cannot get the data that the call to login is suppose to pass along. </p>
  
  <p>I believe there is a difference in the curl call and the httpclient call but i am not sure. </p>
  
  <p>any help is appreciated. 
  I have edited the code to the following but response string is still empty <a href="https://i.stack.imgur.com/6BsyJ.jpg" rel="nofollow noreferrer">Copy of debug view</a></p>
  
  <pre><code>        public async Task&lt;ActionResult&gt; Index()
      {
          using (var client = new HttpClient()) { 
          client.BaseAddress = new Uri(CloudApi);
          client.DefaultRequestHeaders.Accept.Clear();
          //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
          var values = new Dictionary&lt;string, string&gt;
          {
             { "clientId", "65912" },
             { "password", "cloudidx" }
  
          };
          var content = new FormUrlEncodedContent(values);
          HttpResponseMessage response = await client.PostAsync("login", content);
              string responseString = String.Empty;
              if (response.IsSuccessStatusCode)
          {
               responseString = await response.Content.ReadAsStringAsync();
  
          }
      }
          return View();
      }
  </code></pre>
  
  <p>here is the curl call that works </p>
  
  <pre><code>function cloudIDXCall($url, $method, $data = array()) {
  
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // return response as a string
  curl_setopt($curl, CURLOPT_SSLVERSION, 3); // force default SSL version to 3    
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // turn off verification of the remote server's certificate - helps with Windows
  
  $queryString = http_build_query($data); // pack parameters into a URL query string
  
  if ($method == 'get') {
      // GET is the default request method for cURL
      if (strlen($queryString) &gt; 0) $url = $url . '?' . $queryString; // append parameters for GET
  } elseif ($method == 'post') {
      curl_setopt($curl, CURLOPT_POST, 1);
      curl_setopt($curl, CURLOPT_POSTFIELDS, $queryString); // set parameters for POST
  } else {
      return array('failure' =&gt; 'Invalid method');
  }
  
  curl_setopt($curl, CURLOPT_URL, $url);
  $response = curl_exec($curl);
  
  if ( !$response ) {
      $errMsg = "Error: " . curl_error($curl) . " - Code: " . curl_errno($curl);
      curl_close($curl);
      return array('failure' =&gt; $errMsg);
  }
  
  $responseArray = json_decode ($response, $assoc = true); // decode JSON into assoc array
  curl_close($curl);
  return $responseArray;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; solved the issue... Not sure why it made a difference but it did.
  </code></pre>