i am trying to develop an app. that will send form datas to web pages. when I write following expression to browser's adress line it accepts user name and password then redirects me to date.asp.
ex.
Then I try to use that expression as follows but when I read the response stream, i see that it is still the login.asp page (not date.asp).
WebRequest wrq = WebRequest.Create("
WebResponse response = wrq.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader (responseStream);
String res = reader.ReadToEnd ();
textBox1.Text = res;
I also tried to POST data via outputstream as follows:
ASCIIEncoding encoding=new ASCIIEncoding();
string postData= "txtUser=jfa&txtPass=jfa&cmdOK=Submit"
byte[] data = encoding.GetBytes(postData);
string address = "WebRequest wrq = WebRequest.Create(address);
wrq.Method = "POST";
wrq.ContentType = "application/x-wrq.ContentLength = data.Length;
Stream outputStream = wrq.GetRequestStream();
outputStream.Write (data, 0, data.Length);
outputStream.Close ();
//read response
WebResponse response = wrq.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader (responseStream);
String res = reader.ReadToEnd ();
textBox1.Text = res;
but it didn't work again.. Waiting for any idea. thanks
ex.
Then I try to use that expression as follows but when I read the response stream, i see that it is still the login.asp page (not date.asp).
WebRequest wrq = WebRequest.Create("
WebResponse response = wrq.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader (responseStream);
String res = reader.ReadToEnd ();
textBox1.Text = res;
I also tried to POST data via outputstream as follows:
ASCIIEncoding encoding=new ASCIIEncoding();
string postData= "txtUser=jfa&txtPass=jfa&cmdOK=Submit"
byte[] data = encoding.GetBytes(postData);
string address = "WebRequest wrq = WebRequest.Create(address);
wrq.Method = "POST";
wrq.ContentType = "application/x-wrq.ContentLength = data.Length;
Stream outputStream = wrq.GetRequestStream();
outputStream.Write (data, 0, data.Length);
outputStream.Close ();
//read response
WebResponse response = wrq.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader (responseStream);
String res = reader.ReadToEnd ();
textBox1.Text = res;
but it didn't work again.. Waiting for any idea. thanks