title: How to send parameters on an Https POST with C#
body: <p>I have asked <a href="https://stackoverflow.com/questions/1439678/https-post-from-php-to-c">here</a> how to make the https post, and now that works fine. Problem now is How to send a parameter, name query, which is a JSON string:</p>
  <p>{&quot;key1&quot;:&quot;value1&quot;, &quot;key2&quot;:{&quot;key21&quot;:&quot;val21&quot;} }</p>
  <p>What I'm doing and doesn't work is:</p>
  <pre><code>HttpWebRequest q = (HttpWebRequest)WebRequest.Create(Host + &quot;:&quot; + Port);
  ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);
  q.Method = &quot;POST&quot;;
  q.ContentType = &quot;application/json&quot;;
  q.Headers.Add(&quot;JSON-Signature&quot;, GetFirma(query));
  q.Credentials = new NetworkCredential(user,pass);
  
  byte[] buffer = Encoding.UTF8.GetBytes(&quot;query=&quot; + query);
  
  q.ContentLength = buffer.Length;
  
  using (Stream stream = q.GetRequestStream())
  {
       stream.Write(buffer, 0, buffer.Length);                    
  }
  </code></pre>
  <p>But the server always answer saying there's no 'query' parameter. Any help?</p>