getting the value of a form sent from HttpWebRequest

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top