HttpRequest Issue

J

Jacko

Hi

if i post the following code, the first textbox (txt_login) contains input
of both login and password ie (e-mail address removed) notmypassword, how do i seperate
them?

StringBuilder sb = new StringBuilder();
sb.Append(string.Format("{0}={1}", "txt_login", "(e-mail address removed)"));
sb.Append(string.Format("{0}={1}", "txt_password",
"notmypassword"));

ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(sb.ToString());

webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";

webRequest.ContentLength = data.Length;
Stream newStream = webRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();


TIA
Barry
 
F

Family Tree Mike

Jacko said:
Hi

if i post the following code, the first textbox (txt_login) contains input
of both login and password ie (e-mail address removed) notmypassword, how do i
seperate them?

StringBuilder sb = new StringBuilder();
sb.Append(string.Format("{0}={1}", "txt_login",
"(e-mail address removed)"));
sb.Append(string.Format("{0}={1}", "txt_password",
"notmypassword"));

ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(sb.ToString());

webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";

webRequest.ContentLength = data.Length;
Stream newStream = webRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();


TIA
Barry


I don't do a lot of ASP, but don't you have to separate the args with an &
sign? You have nothing separating the parameters, so you are passing:
"[email protected]=notmypassword".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top