473,658 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2466
"John Saunders" <jo***********@ surfcontrol.com > wrote in message news:<Or******* *******@TK2MSFT NGP12.phx.gbl>. ..
"Jeff Baker" <jb*****@hotmai l.com> wrote in message
news:78******** *************** **@posting.goog le.com...
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",
"applicatio n/x-www-form-urlencoded")
Dim myQueryStringCo llection As New
System.Collecti ons.Specialized .NameValueColle ction

myQueryStringCo llection.Add("u sername", "test")
myQueryStringCo llection.Add("p assword", "tickle")

client.QueryStr ing = myQueryStringCo llection
Dim ResponseData As Byte() =
client.Download Data("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*****@hotmai l.com> wrote in message
news:78******** *************** ***@posting.goo gle.com...
"John Saunders" <jo***********@ surfcontrol.com > wrote in message

news:<Or******* *******@TK2MSFT NGP12.phx.gbl>. ..
"Jeff Baker" <jb*****@hotmai l.com> wrote in message
news:78******** *************** **@posting.goog le.com...
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",
"applicatio n/x-www-form-urlencoded")
Dim myQueryStringCo llection As New
System.Collecti ons.Specialized .NameValueColle ction

myQueryStringCo llection.Add("u sername", "test")
myQueryStringCo llection.Add("p assword", "tickle")

client.QueryStr ing = myQueryStringCo llection
Dim ResponseData As Byte() =
client.Download Data("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.Query String 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***********@s urfcontrol.com
Nov 17 '05 #3

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

Similar topics

0
1277
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 it comes to POSTing, I've been able to post to websites using both the webrequest/response and webclient methods. However, the problem I'm running into with both options is I seem to "lose" my connection/session. Let me try to explain a little better. I connect to a website which
0
2038
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 data to uploads.. Most of process is quite easy and simple. But ebay webserver send me your password is not valid... But the password is clearly correct.. you can type it at the result page and submit. Then you can see a message - bidding has ended and you are logged in. <- This is the message...
6
12232
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 itself. The problem is only with C# webClient . The code is pretty simple. string uriString = saveTargetToAddress.Text; string postData = textOutput.Text; try
6
13285
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 defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
1
2974
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 got an unposted version - like if I had just made a simple request without posting anything. I have written the same thing using the Perl's LWD::UserAgent class and it was the same. The web form is really very simple. As soon as I created the ASP file with the same form everything worked! Does...
0
4074
by: Kumar | last post by:
Hi all, I have the following code which uses WebClient.UploadValues myNameValueCollection.Add("Name", name) myNameValueCollection.Add("Age", age) .............. ............. Dim web As New System.Net.WebClient web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
3
7574
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 (supposedly) posted to it. If I make a web page with a form and the values, test.asp reports them fine. ---------------------------- Dim thePost As String = "Variable1=Value1&Variable2=Value2&Variable3=Value3" Dim thePage As Byte() Dim MyWebClient As New System.Net.WebClient
3
2900
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 positive response. If I access the remote file in Firefox the Adobe PDF Reader in Firefox kicks off and I can view the file just fine. HOWEVER, if I try to access the file using Internet Explorer Adobe never kicks off and I receive a screenfull of text (which looks like the raw text data of the...
2
2197
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 problem, but am having problems doing this. I'm basically trying to upload a file from my .net app running on my local pc to a unix webserver (running iplanet). Just upload and store the file, thats it. I'm using webclient.uploadfile on the client side. Since its an iplanet webserver, I cant use...
0
8330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8746
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
8523
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
8626
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...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.