How to add query string and json data to httpWebRequest type POST
<p><strong>Javacode here:</strong></p>

<pre><code>function sendTextMessage(sender, text) {
  messageData = {
    text:text
  }
  request({
    url: 'https://graph.facebook.com/v2.6/me/messages',
    qs: {access_token:token},
    method: 'POST',
    json: {
      recipient: {id:sender},
      message: messageData,
    }
  }, function(error, response, body) {
    if (error) {
      console.log('Error sending message: ', error);
    } else if (response.body.error) {
      console.log('Error: ', response.body.error);
    }
  });
}
</code></pre>

<p>And C# code, I want to replace <code>"?access_token=dshfhsfhrthytrghfgbfhnytfht"</code> by code, because the url use type <code>POST</code>. I find out that I can use <code>WebRequest</code> but i don't know how I use <code>WebRequest</code> to add <code>Json</code> data, so I use HttpWebrequest, Http Webrequest can add query string by <code>StringBuilder</code> , but how i Write post data and json? In this code I just Write <code>json data</code></p>

<pre><code>public void sendTextMessage(string sender, string text) {
            string json = "{ recipient: {id:"+sender+ "} , message: {text: \""+text+"\"}";
            var request = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/v2.6/me/messages?access_token=dshfhsfhrthytrghfgbfhnytfht");
            request.ContentType = "application/json";
            request.Method = "POST";

            using (var streamWriter = new StreamWriter(request.GetRequestStream()))
            {                
                streamWriter.Write(json);
                streamWriter.Flush();
                streamWriter.Close();
            }
            var httpResponse = (HttpWebResponse)request.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
            }
        }
</code></pre>