I'm using C#.NET WebRequest and HTTPResponse to post data to a server and I'm reading the response into a stream. Does anyone know how to split the returned values like a request.form["Variable"]. Here is the code. Thanks!
WebRequest request = WebRequest.Create("Webiste.com");
request.Method = "POST";
string postData = "";
postData += "Value1=C&";
postData += "Value2=S";
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 reponse = request.GetResponse();
Response.Write(((HttpWebResponse)reponse).StatusDe scription);
dataStream = reponse.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
Response.Write(responseFromServer);
reader.Close();
dataStream.Close();
reponse.Close();