472,347 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

WebClient form Posting with form name?

How does one post to an ASPX page using the WebClient when the form
name is required?
Nov 17 '05 #1
2 2367
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:<Or**************@TK2MSFTNGP12.phx.gbl>...
"Jeff Baker" <jb*****@hotmail.com> wrote in message
news:78*************************@posting.google.co m...
How does one post to an ASPX page using the WebClient when the form
name is required?


Could you be more specific?

Dim client As New WebClient

client.Headers.Add("Content-Type",
"application/x-www-form-urlencoded")
Dim myQueryStringCollection As New
System.Collections.Specialized.NameValueCollection

myQueryStringCollection.Add("username", "test")
myQueryStringCollection.Add("password", "tickle")

client.QueryString = myQueryStringCollection
Dim ResponseData As Byte() =
client.DownloadData("http://www.mytestsite.com/index.aspx")

From the code above I'm posting the "username" and "password" to the
"index.aspx" page and downloading the page ingo the ResponseData Byte
array. What happens if the index.aspx page has more than one form and
I want to post to a specific form OR if the index.aspx page is
specifically looking for a form name to via the request object??

How can I specifiy the form name when using the WebClient class to
post information to a page/form??
Nov 17 '05 #2
"Jeff Baker" <jb*****@hotmail.com> wrote in message
news:78**************************@posting.google.c om...
"John Saunders" <jo***********@surfcontrol.com> wrote in message

news:<Or**************@TK2MSFTNGP12.phx.gbl>...
"Jeff Baker" <jb*****@hotmail.com> wrote in message
news:78*************************@posting.google.co m...
How does one post to an ASPX page using the WebClient when the form
name is required?


Could you be more specific?

Dim client As New WebClient

client.Headers.Add("Content-Type",
"application/x-www-form-urlencoded")
Dim myQueryStringCollection As New
System.Collections.Specialized.NameValueCollection

myQueryStringCollection.Add("username", "test")
myQueryStringCollection.Add("password", "tickle")

client.QueryString = myQueryStringCollection
Dim ResponseData As Byte() =
client.DownloadData("http://www.mytestsite.com/index.aspx")

From the code above I'm posting the "username" and "password" to the
"index.aspx" page and downloading the page ingo the ResponseData Byte
array. What happens if the index.aspx page has more than one form and
I want to post to a specific form OR if the index.aspx page is
specifically looking for a form name to via the request object??

How can I specifiy the form name when using the WebClient class to
post information to a page/form??


WebClient.QueryString gets/sets the query string. You are downloading from

http://www.mytestsite.com/index.aspx...assword=tickle.

You aren't POSTing at all, you're using a GET.

See a recent thread in this newsgroup called "Going crazy over HTTP Post
from class library". Make sure you read the entire thread!
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com
Nov 17 '05 #3

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

Similar topics

0
by: omyek | last post by:
I'm essentially trying to do what a lot of users seem to want when using the above classes, and that's POST to a webpage. Well, I'm golden when...
0
by: mc kim via .NET 247 | last post by:
What I am trying to is automatic bidding process in Ebay site... WebClient class can uploads form data easily. I have collected ebay url & form...
6
by: genc ymeri | last post by:
Hi, We are struggeling to upload a file through a C# webClient into JBoss web server. Meanwhile we are able to upload a file from the webserver...
6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that...
1
by: Adnan Selimovic | last post by:
Hi folks! I tried to post a web form using the WebClient class and HttpWebRequest/HttpWebResponse. It didn't work for the ASPX web pages. I always...
0
by: Kumar | last post by:
Hi all, I have the following code which uses WebClient.UploadValues myNameValueCollection.Add("Name", name) myNameValueCollection.Add("Age",...
3
by: Manuel | last post by:
I have an asp page ("test.asp") that presents the data it receives from a post.When I try the following code, test.asp doesn't return the values...
3
by: bss2004 | last post by:
Help! I'm posting a PDF Doc to a remote server using WebClient UploadData and the following code. The DOC posts fine and the server returns a...
2
by: marfi95 | last post by:
Hello all. I'm not sure if this is the correct place to post this, but if not please let me know. This is my situation. I have a simple...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.