Hi,
Please help me with this one as it's driving me crazy for some days now. I want to send some data to to web form in this page http://www.belestrane.nadlanu.com/site/default.asp?lang=en probably through a HTTP POST method and then read the response and use that in my c# windows application. With some packet sniffing a found out how should I send the variables but I cant manage to get a valid response.
WebRequest wReq = WebRequest.Create("http://www.telekom.yu/WhitePages/ResultPage.asp");
wReq.Method = "POST";
wReq.UseDefaultCredentials = true;
string postData = "Telefon=&Ulica=&MG=022&Ime=&Broj=&Mesto=&Prezime=KORHNER";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
wReq.ContentType = "application/x-www-form-urlencoded";
wReq.ContentLength = byteArray.Length;
Stream dataStream = wReq.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse wRes = wReq.GetResponse();
this.Text = ((HttpWebResponse)wRes).StatusDescription.ToString();
dataStream = wRes.GetResponseStream();
StreamReader stReader = new StreamReader(dataStream);
txtOutput2.Text = stReader.ReadToEnd();
stReader.Close();
dataStream.Close();
wRes.Close();