HttpRequest Issue

  • Thread starter Thread starter Jacko
  • Start date Start date
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
 
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".
 
Back
Top