title: PUT request working in vb.net but not in C#.net
body: <p>I am developing a REST client in C# that performs the following operation:</p>
  
  <ol>
  <li>It sends a POST request to the server with a query string parameter PolicyId=myhotp and this json data {"uid":"<em>name</em>"}.</li>
  <li>The server responds with json data with state id like this {"state":"323434j2hj"}</li>
  <li>I extract the value of "state" from the received json data and send
  it in another PUT request to the same server with OTP in order to verify. stateid is sent as query string parameter StateId=ihhfueh8f88 and otp is sent as json data {"otp":"123456"}. The server verifies OTP against state id.</li>
  </ol>
  
  <p>But the server responds that the stateid is invalid. Irony is that this same procedure works when I use old way i.e. Microsoft.XMLHTTP to make requests but it doesn't work with HTTP Client. I am not able to transfer state id in query string. 
  Here is my code using HTTP Client:</p>
  
  <pre><code>        User user = new User();
          user.uid = "username";
          String json = JsonConvert.SerializeObject(user);
          MessageBox.Show(json);
          HttpClient client = new HttpClient();
          client.BaseAddress = new Uri("http://fqdn");
          client.DefaultRequestHeaders.Add("Accept", "application/json");
          var response = client.PostAsync("api?myhotp", new StringContent(json, Encoding.UTF8, "application/json")).Result;
          var contents = response.Content.ReadAsStringAsync().Result;
          MessageBox.Show(contents);
          var obj = JObject.Parse(contents);
          string id = (string)obj["state"];
          MessageBox.Show(id);
          Otp otpObj = new Otp();
          otpObj.otp = "123456";
          String jsonotp = JsonConvert.SerializeObject(otpObj);
          MessageBox.Show(jsonotp);
          client = new HttpClient();
          client.BaseAddress = new Uri("http://fqdn");
          client.DefaultRequestHeaders.Add("Accept", "application/json");
          response = client.PutAsync("api?StateId="+id, new StringContent(json, Encoding.UTF8, "application/json")).Result;
          contents = response.Content.ReadAsStringAsync().Result;
          MessageBox.Show(contents);
  </code></pre>
  
  <p>Here is the code with Microsoft.XMLHTTP:</p>
  
  <pre><code>       Type xmlType = Type.GetTypeFromProgID("Microsoft.XMLHTTP");
          dynamic objXML = Activator.CreateInstance(xmlType);
          objXML.Open("POST", "http://fqdn/api?PolicyId=myhotp", false);
          objXML.setRequestHeader("Content-Type", "application/json");
          objXML.setRequestHeader("Accept", "application/json");
          //objXML.setOption(2, 13056);
          objXML.Send(json);
          MessageBox.Show(objXML.status.ToString());
          MessageBox.Show(objXML.responseText.ToString());
          var obj = JObject.Parse(objXML.responseText.ToString());
          String id = (String)obj["state"];
          MessageBox.Show(id);
          Otp otpObj = new Otp();
          otpObj.otp = "123456";
          json = JsonConvert.SerializeObject(otpObj);
          MessageBox.Show(json);
          objXML.Open("PUT", "http://fqdn/api?StateId="+id, false);
          objXML.setRequestHeader("Content-Type", "application/json");
          objXML.setRequestHeader("Accept", "application/json");
          objXML.Send(json);
          MessageBox.Show(objXML.status.ToString());
          MessageBox.Show(objXML.responseText.ToString());
  </code></pre>