WebRequest

  • Thread starter Thread starter Christian Pické
  • Start date Start date
C

Christian Pické

Hi,

I have to do a POST to an URI.

I already figured out this code:

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

myRequest.Method = "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="1234TestcartID">

// <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="Christian Picke"> <input
type="hidden" name="address" value="Edingsesteenweg 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="(e-mail address removed)">

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

// </form>


Many thanks in advance,

Christian
 
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/d...fsystemnetwebclientclassuploadvaluestopic.asp


Hi,

I have to do a POST to an URI.

I already figured out this code:

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

myRequest.Method = "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="1234TestcartID">

// <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="Christian Picke"> <input
type="hidden" name="address" value="Edingsesteenweg 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="(e-mail address removed)">

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

// </form>


Many thanks in advance,

Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top