I am using the following code to create an HTTP message. This works great in most cases, but it cuts off my lines at a specific length of about 4300 line characters. How can I get around this problem? I have a suspicion that this is due to all data that is not published and not trimmed at the time of publication. How can I get around this problem?
ASCIIEncoding encoding = new ASCIIEncoding();
WebRequest request = WebRequest.Create("<URL>");
request.Method = "POST";
string postData = "json=" + json;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
retVal = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
source
share