//1st request
webrequest = (HttpWebRequest)HttpWebRequest.Create(sLink);
webrequest.KeepAlive=true;
//webrequest.Pipelined = true;
webrequest.Timeout =3000;
webrequest.Method = "POST";
webrequest.UserAgent= "beone/v1.0";
webrequest.Headers.Add("Beone-Encoding: " + gwid + "\n");
webrequest.ProtocolVersion = HttpVersion.Version10;
webrequest.Connection = "keepalive";
string sdata = "Testing";
byte [] data = enc.GetBytes(sdata);
Stream stream = webrequest.GetRequestStream();
stream.Write(data,0,data.Length);
stream.Close();
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
StreamReader reader = new StreamReader(webresponse.GetResponseStream());
char[] readbuffer = new char[256];
int count = reader.Read(readbuffer,0,256);
while(count>0)
{
string outputdata = new string(readbuffer,0,count);
buffer = buffer + outputdata;
count = reader.Read(readbuffer,0,256);
}
MessageBox.Show(buffer);
//2nd request
string sdata = "Testing";
byte [] data = enc.GetBytes(sdata);
Stream stream = webrequest.GetRequestStream();
stream.Write(data,0,data.Length);
stream.Close();
HttpWebResponse response = (HttpWebResponse)webrequest.GetResponse();
StreamReader reader1 = new StreamReader(webresponse.GetResponseStream());
char[] readbuffer1 = new char[256];
int count1 = reader.Read(readbuffer1,0,256);
while(count1>0)
{
string outputdata1 = new string(readbuffer1,0,count);
buffer = buffer + outputdata1;
count = reader.Read(readbuffer1,0,256);
}
reader.Close();
webresponse.Close();
response.Close();