473,804 Members | 3,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="useri d="+strId;
postData += ("&username="+s trName);
byte[] data = encoding.GetByt es(postData);
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest )WebRequest.Cre ate("http://localhost/MyIdentity/Default.aspx"
);
myRequest.Metho d = "POST";
myRequest.Conte ntType="applica tion/x-www-form-urlencoded";
myRequest.Conte ntLength = data.Length;
Stream newStream=myReq uest.GetRequest Stream();
// Send the data.
newStream.Write (data,0,data.Le ngth);
newStream.Close ();


Thanks for any help you can offer!

Steve
Nov 17 '05 #1
1 1236
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******** ******@TK2MSFTN GP12.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="useri d="+strId;
postData += ("&username="+s trName);
byte[] data = encoding.GetByt es(postData);
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest )WebRequest.Cre ate("http://localhost/MyIdentity/Default.aspx" );
myRequest.Metho d = "POST";
myRequest.Conte ntType="applica tion/x-www-form-urlencoded";
myRequest.Conte ntLength = data.Length;
Stream newStream=myReq uest.GetRequest Stream();
// Send the data.
newStream.Write (data,0,data.Le ngth);
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
2001
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: Mypage.aspx?Password=Mypassword When this request hits the page, I need to pull that variable Mypassword to use in my VB function to query the database. I'm confused on how to get it. I tried using
4
1537
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 to progmattically access a login account by posting the username and password and then maintaining the session so that the program can continue to access web pages that require a valid login sesssion. The big if for me is maintaining the...
10
1946
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"> <input type="hidden" name="thisPage" value="pispCheckDomain"> <input type="hidden" name="username" value="test"> <input type="hidden" name="password" value="test"> domain_name: <input type="text" name="domain_name"><br>
5
5994
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 event is fired by one of the controls contained in the User Control, these variable are reset. Here is my current code (I have a little more to add later, right now I am just concerned about the variables getting reset): Public Class DatePicker2...
8
1818
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 on a separate ASP page). Here is the code behind the button that will launch the report (is in a file called StateSelect.aspx.vb: Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click...
3
4081
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 from a .NET Web Application hosted on IIS. In our setup the web request form a client can be running for long duration (may be more than 4 hours). We are getting exceptions during the HTTP send/receive inside the web service method. The exception...
3
2193
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
4352
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 proxy the connections to which must be authenticated. The 400 error are comming fron the wed server back through the proxy. When I Sniff the connections I can see that the http message that is causing the issue is one that is part of the...
6
18243
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 = service.getMethod(a, b, c, d) then iterating through for (int i = 0; i < results .Length; i++)
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10583
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.