Example
string requestUri = "http://www.example.com";
string requestBodyString = "Request body string.";
string contentType = "text/plain";
string requestMethod = "POST";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri)
{
Method = requestMethod,
ContentType = contentType,
};
byte[] bytes = Encoding.UTF8.GetBytes(requestBodyString);
Stream stream = request.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();