S
Steve Klett
Hello-
I would like to implement something like what is covered in this article:
http://www.netomatix.com/HttpPostData.aspx
It shows how to post a form programtically vs with an actual form from a web
page.
Basically, I will have a desktop application that will post a form to an
..aspx page.
I need to retrieve the values from the form that is sent.
When I look at Request.Form AllKeys it does not have my form elements from
the desktop application. Where do I retrieve these values?
Here is a snip from the article for those that don't feel like following a
link right now. This should give you an idea of what I'm after
ASCIIEncoding encoding=new ASCIIEncoding();
string postData="userid="+strId;
postData += ("&username="+strName);
byte[] data = encoding.GetBytes(postData);
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://localhost/MyIdentity/Default.aspx"
);
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// Send the data.
newStream.Write(data,0,data.Length);
newStream.Close();
Thanks for any help you can offer!
Steve
I would like to implement something like what is covered in this article:
http://www.netomatix.com/HttpPostData.aspx
It shows how to post a form programtically vs with an actual form from a web
page.
Basically, I will have a desktop application that will post a form to an
..aspx page.
I need to retrieve the values from the form that is sent.
When I look at Request.Form AllKeys it does not have my form elements from
the desktop application. Where do I retrieve these values?
Here is a snip from the article for those that don't feel like following a
link right now. This should give you an idea of what I'm after
ASCIIEncoding encoding=new ASCIIEncoding();
string postData="userid="+strId;
postData += ("&username="+strName);
byte[] data = encoding.GetBytes(postData);
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://localhost/MyIdentity/Default.aspx"
);
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// Send the data.
newStream.Write(data,0,data.Length);
newStream.Close();
Thanks for any help you can offer!
Steve