473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

getting the value of a form sent from HttpWebRequest

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
Nov 17 '05 #1
1 1216
Hi Steve,

You might want to investigate Webclient which does what you need:

http://msdn.microsoft.com/library/de...estingData.asp

"Steve Klett" <sk************@yahoo.com> wrote in message
news:em**************@TK2MSFTNGP12.phx.gbl...
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

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Beryl Small | last post by:
Hi, I have a third party software that needs to send information to an .aspx page for processing to communicate with an SQL database. The software sends the information something like this: ...
4
by: Ron Vecchi | last post by:
I know this has messiness written all over it but I have a question about using HttpWebRequest/Response to essentially spider a website and post information to the forms. The (very) basic goal is...
10
by: Peter Afonin | last post by:
Hello, I have a simple client-side form that is checking the domain availability on the domain registrar's server: <FORM action="https://www.webnames.ru/scripts/RegTimeSRS.pl" method="post">...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
8
by: Brent White | last post by:
If you need more information, I'd be glad to give it, but I am developing an ASPX page so that the user can select multiple values for a specific field, then pass them on (using Crystal Reports 10...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
3
by: Jason Huang | last post by:
Hi, In my C# Windows form project, I want to verify that if a file http://myip/myfile.doc exists, how am I supposed to do? (the myip is a specific public IP) Thanks for help. Jason
1
by: JohnH | last post by:
Hi, In my application which has two or more threads calling web service or just HttpWebRequest I am seeing some HTTP 400 errors retrun in the response. All the calls are going through the same ISA...
6
by: plork | last post by:
hi all i'm calling a web service method and can get it's results just fine however i want to grab the repsonse message from the call is anyone able to tell me how i do this? results =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.