473,785 Members | 2,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebClient

Hi

I need to post a form to an external URL, get a repsonse, then repost
to an external URL and redirect at the same time. I can figure out step
1 and step 2 fine but I cant seem to figure out how to send a form and
send the client to the external url at the same time. Can anyone help?

'Step 1 create form data
Dim formPostData As String = String.Empty
formPostData &= "AmountPaid =" & Booking.AmountP aid
formPostData &= "Fullname=" & Booking.Fullnam e

'Step 2 send to XXXX and get response
client = New Net.WebClient
client.Headers. Add("Content-Type", "applicatio n/x-www-form-urlencoded")
postByteArray = Encoding.ASCII. GetBytes(formPo stData)
responseArray = client.UploadDa ta(PaymentURL, "POST", postByteArray)
response = Encoding.ASCII. GetString(respo nseArray)

'step 3 recreate form and send on to exteranl url
formPostData = "epdqData=" & response
client = New Net.WebClient
client.Headers. Add("Content-Type", "applicatio n/x-www-form-urlencoded")
postByteArray = Encoding.ASCII. GetBytes(formPo stData)
client.UploadDa ta(PaymentURL, "POST", postByteArray)

HOW DO I SEND CLIENT ON TO EXTERNAL URL HERE?

many thanks
Rippo

Jun 14 '06 #1
1 1762
To post the form to an external site while sending the user there as well,
you can simply output a standard webform with the fields all filled in.
Then output a line of Javascript such as document.submit ().
This will send the page to the user's browser and immediately submit it as
if the user had themselves clicked the submit button on the form.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Rippo" <in**@rippo.co. uk> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
Hi

I need to post a form to an external URL, get a repsonse, then repost
to an external URL and redirect at the same time. I can figure out step
1 and step 2 fine but I cant seem to figure out how to send a form and
send the client to the external url at the same time. Can anyone help?

'Step 1 create form data
Dim formPostData As String = String.Empty
formPostData &= "AmountPaid =" & Booking.AmountP aid
formPostData &= "Fullname=" & Booking.Fullnam e

'Step 2 send to XXXX and get response
client = New Net.WebClient
client.Headers. Add("Content-Type", "applicatio n/x-www-form-urlencoded")
postByteArray = Encoding.ASCII. GetBytes(formPo stData)
responseArray = client.UploadDa ta(PaymentURL, "POST", postByteArray)
response = Encoding.ASCII. GetString(respo nseArray)

'step 3 recreate form and send on to exteranl url
formPostData = "epdqData=" & response
client = New Net.WebClient
client.Headers. Add("Content-Type", "applicatio n/x-www-form-urlencoded")
postByteArray = Encoding.ASCII. GetBytes(formPo stData)
client.UploadDa ta(PaymentURL, "POST", postByteArray)

HOW DO I SEND CLIENT ON TO EXTERNAL URL HERE?

many thanks
Rippo

Jun 14 '06 #2

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

Similar topics

11
942
by: ptass | last post by:
Hi I've installed win2k3 sp1 on a machine where an openRead on any given file was previously working. After installation, I get a webException as follows... ..message "An exception occurred during a webclient request" .._Hresult = "-2146233079" .._COMPlusExceptionCode ="-532459699" Sorry I don't have the whole error, but this seems to be the only pertinent
3
67671
by: Ram Baruch | last post by:
Hi, I'm trying to use WebClient class to upload data. In order to upload it, I need to use my username and password. Does somebody know how can I set it in the WebClient class? Regards, Ram.
2
5369
by: xzzy | last post by:
I have .net 1.1 c# . . . . . using System.Net only lists sockets what do I need to do to be able to do: using System.Net.WebClient;
6
13304
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");
6
22105
by: Giovanni | last post by:
Hi Guys, Really strange problem I am experiencing... I have setup a virtual directory with Read Only permissions on an ISA/IIS server (SBS 2003). In that virt. dir., I placed 1 file (setup.exe). I then use WebClient.DownloadFileAsync (.NET 2.0 Pro.) and all downloads well including progress bar indicator, bytes received, etc... Here is the problem: When I replace the file (setup.exe), with a different, larger file, it still...
1
6293
by: vin.dor | last post by:
Dear All, I am using WebClient in my Visual Studio .Net 2003 project to download an image from the Internet. The following is my function: C# Code: public static bool downloadFile(string URL, ref string fileName) { bool result = true;
4
7784
by: Lehel Kovach | last post by:
I'm having a problem with the WebClient object. When I post data to certain sites, it will receive a command from the webserver (object moved) and continue to the next link by downloading that. The problem is, certain cookies need to be set, and the only way of doing that is not letting the WebClient automatically go on to the next GET in the background--I need to do it manually. I'm wondering if this has something to do with the...
1
6496
by: Mad Scientist Jr | last post by:
For some reason I can't get a WebClient to access an outside URL from behind our firewall. The code works when it runs outside the firewall. I turned on windows authentication in the web.config <authentication mode="Windows" /> and set up IIS to not allow anonymous access. My browser is set up to auto detect the proxy server, so IE/Firefox can access outside pages, so I added code to auto-detect the proxy server.
1
12503
by: Mike | last post by:
I am using PowerShell to download an XML file into a string using the DownloadString(URI) method of System.Net.WebClient object. Sample commands below: $Result = $Null; $WebClient = new-object System.Net.WebClient; $WebClient.Encoding = ::Default; $WebClient.Proxy = ::DefaultWebProxy; $WebClient.Proxy.Credentials = ::DefaultCredentials;
2
10175
by: MichaelSchoeler | last post by:
Hi, I'm having problems with the WebClient class regarding UTF-8 encoded data. When I access a specific webservice directly I can see the data arrives in corretly formatted UTF-8. But when I try to pull data from the same webservice url through the WebClient class I get partly garbled UTF-8 data in return. Only some UTF-8 chars (double byte pairs) seems to be corrupted. // Does not work WebClient wc = new WebClient(); string...
0
9643
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
9480
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
10315
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
10147
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...
0
9947
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
8968
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
5379
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
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.