Using reqStream As Stream = req.GetRequestStream()
Dim resp As System.Net.WebResponse = Nothing Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(address) Dim byteData() As Byte CType(req, HttpWebRequest).KeepAlive = False CType(req, HttpWebRequest).Headers.Add("HTTP_ACCEPT_ENCODING", "gzip,deflate,sdch") req.Method = "POST" req.Timeout = 60000 req.ContentType = "application/json" byteData = Encoding.UTF8.GetBytes(strRequestJSON) req.ContentLength = byteData.Length Using reqStream As Stream = req.GetRequestStream() reqStream.Write(byteData, 0, byteData.Length) reqStream.Close() End Using Dim myHttpWebResponse As HttpWebResponse = CType(req.GetResponse(), HttpWebResponse) Return New System.IO.StreamReader(myHttpWebResponse.GetResponseStream(), System.Text.Encoding.UTF8).ReadToEnd()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)