473,666 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebRequest

Hi,

I have to do a POST to an URI.

I already figured out this code:

WebRequest myRequest =
WebRequest.Crea te("https://select.worldpay .com/wcc/purchase");

myRequest.Metho d = "POST";
Question:
How can I add parameters to this request?
The sample provided by the owner of the web site in HTML was:

// <form action="https://select.worldpay .com/wcc/purchase" method="post">

// <input type="hidden" name="instId" value="53567563 "> <input type="hidden"
name="cartId" value="1234Test cartID">

// <input type="hidden" name="amount" value="25.35"> <input type="hidden"
name="currency" value="EUR">

// <input type="hidden" name="desc" value="TestDesc "> <input type="hidden"
name="testMode" value="100">

// <input type="hidden" name="name" value="Christia n Picke"> <input
type="hidden" name="address" value="Edingses teenweg 492">

// <input type="hidden" name="postcode" value="9400"> <input type="hidden"
name="country" value="BE">

// <input type="hidden" name="tel" value="054/336034"> <input type="hidden"
name="email" value="in**@sof t-service.net">

// <input type="submit" value="Buy This">

// </form>
Many thanks in advance,

Christian
Nov 17 '05 #1
2 2554
Salut Christian,
It seems like you might want to be using the WebClient class for this. The
UploadValues method lets you set any number of values to send along with the
post.

There are examples here:

http://msdn.microsoft.com/library/de...aluestopic.asp
"Christian Pické" <in**@soft-service.net> wrote in message
news:ew******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have to do a POST to an URI.

I already figured out this code:

WebRequest myRequest =
WebRequest.Crea te("https://select.worldpay .com/wcc/purchase");

myRequest.Metho d = "POST";
Question:
How can I add parameters to this request?
The sample provided by the owner of the web site in HTML was:

// <form action="https://select.worldpay .com/wcc/purchase" method="post">

// <input type="hidden" name="instId" value="53567563 "> <input type="hidden"
name="cartId" value="1234Test cartID">

// <input type="hidden" name="amount" value="25.35"> <input type="hidden"
name="currency" value="EUR">

// <input type="hidden" name="desc" value="TestDesc "> <input type="hidden"
name="testMode" value="100">

// <input type="hidden" name="name" value="Christia n Picke"> <input
type="hidden" name="address" value="Edingses teenweg 492">

// <input type="hidden" name="postcode" value="9400"> <input type="hidden"
name="country" value="BE">

// <input type="hidden" name="tel" value="054/336034"> <input type="hidden"
name="email" value="in**@sof t-service.net">

// <input type="submit" value="Buy This">

// </form>
Many thanks in advance,

Christian

Nov 17 '05 #2
Salut Christian,
It seems like you might want to be using the WebClient class for this. The
UploadValues method lets you set any number of values to send along with the
post.

There are examples here:

http://msdn.microsoft.com/library/de...aluestopic.asp
"Christian Pické" <in**@soft-service.net> wrote in message
news:ew******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have to do a POST to an URI.

I already figured out this code:

WebRequest myRequest =
WebRequest.Crea te("https://select.worldpay .com/wcc/purchase");

myRequest.Metho d = "POST";
Question:
How can I add parameters to this request?
The sample provided by the owner of the web site in HTML was:

// <form action="https://select.worldpay .com/wcc/purchase" method="post">

// <input type="hidden" name="instId" value="53567563 "> <input type="hidden"
name="cartId" value="1234Test cartID">

// <input type="hidden" name="amount" value="25.35"> <input type="hidden"
name="currency" value="EUR">

// <input type="hidden" name="desc" value="TestDesc "> <input type="hidden"
name="testMode" value="100">

// <input type="hidden" name="name" value="Christia n Picke"> <input
type="hidden" name="address" value="Edingses teenweg 492">

// <input type="hidden" name="postcode" value="9400"> <input type="hidden"
name="country" value="BE">

// <input type="hidden" name="tel" value="054/336034"> <input type="hidden"
name="email" value="in**@sof t-service.net">

// <input type="submit" value="Buy This">

// </form>
Many thanks in advance,

Christian

Nov 17 '05 #3

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

Similar topics

17
7232
by: James Johnson | last post by:
Dear C#dex, I define a variable: HttpWebRequest webRequest and run the following request webRequest = WebRequest.Create(TARGET_URL) as HttpWebRequest; The webRequest object returns values and in the debugger I can see the value I want in the property
3
6345
by: Paul | last post by:
Hello, First I want to refer to the problem "WebRequest : execute a button" of a few days ago. The way I solved it, I loose my session, and as a consequence my session variables. I don't want to keep those variables, as an alternative, as ViewState variables because I don't want to transfer to many hidden fields. This is the code I use :
8
2395
by: John K. | last post by:
Hi I was wondering if it's possible to use the WebRequest class to access a file on windows shared folder with authentication? If yes, what would the syntax be? I've tried to look this up in the references available but to no avail Also, is it safer (better practise) in an LAN environment to use HTTP requests to access shared files (via ASP.NET) rather than UNC file shares TIA Regards John
12
2858
by: ThyRock | last post by:
I am working on a WebRequest accessing the US Postal Service WebTools test API. This service uses a DLL file (ShippingAPITest.dll) with a query string which includes XML. The web service accepts the query string with no url encoding. I must pass the <> characters as they are in the query string. If these characters are url encoded the service rejects the request. This API Url is http://testing.shippingapis.com/ShippingAPITest.dll
0
2211
by: Gordon | last post by:
I use the following code to get source HTML. The second line seems to work when I get no response from a site. However, I want to stop the request if it's taking more than 20 - 30 seconds. I can't seem to make it work. Please point out the mistakes that I have. Thanks code............. WebRequest = WebRequest.Create(URL) WebRequest.Timeout() = RunInfo.ConnectTimeout WebResponse = WebRequest.GetResponse 'WEBRESPONSE IS A PUBLIC OBJECT...
1
4769
by: David Satz | last post by:
Hello--I just upgraded to Visual Studio .NET 2005 and suddenly, all my .NET 1.1 applications that accessed Web sites have broken. For example, this code: WebClient wc = new WebClient(); wc.DownloadFile("http://www.microsoft.com/", "MSFT.htm"); .... throws a WebException on the second line. The WebException doesn't specify a problem, but it has an InnerException of type NullReferenceException with the following stack trace:
2
5965
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an application to download images using System.NET classes (webclient, webrequest) asynchronously behind proxy server. The reading method works like this: System.Net.WebClient client=new System.Net.WebClient();
1
8186
by: Mr Flibble | last post by:
OK I logon to a web site and I manage to get an SMSESSION cookie that I then store in a variable called _session (a class scoping variable). I do this by calling a logon URL and setting a cookie to SMCHALLANGE=YES to allow me to obtain a session. I then iterate the cookie collection to extract the SMSESSION value. All is good (so far). This is when the sky turns grey and the rain starts to fall. I then use this SMSESSION in a web...
3
9583
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm trying to create a call to a web page to validate and register software. The code I'm using is: Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim WebRequest As HttpWebRequest Dim instance As HttpWebRequest =...
3
8170
by: Dave | last post by:
string m_request = some_web_page; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_request ); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Which works fine, but I need to set and send a cookie with the WebRequest. How do I do that?
0
8356
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,...
1
8552
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
8640
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
7387
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...
1
6198
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
4198
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...
1
2773
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
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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.