WebRequest

Discussion in 'ASP .Net' started by Christian Pické, Oct 21, 2003.

  1. 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="">

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

    // </form>


    Many thanks in advance,

    Christian
     
    Christian Pické, Oct 21, 2003
    #1
    1. Advertising

  2. Christian Pické

    Oliver Guest

    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


    "Christian Pické" <> wrote in message
    news:...
    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="">

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

    // </form>


    Many thanks in advance,

    Christian
     
    Oliver, Oct 22, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CodeMotion
    Replies:
    0
    Views:
    565
    CodeMotion
    Jul 3, 2003
  2. Andres
    Replies:
    2
    Views:
    6,654
    Natty Gur
    Aug 14, 2003
  3. Sujith Jagini

    problem with webRequest.method = post

    Sujith Jagini, Aug 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,498
    Natty Gur
    Aug 17, 2003
  4. John Saunders

    Re: problem with webRequest.method = post

    John Saunders, Aug 20, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    417
    John Saunders
    Aug 20, 2003
  5. Tony Guidici

    HTTPS and WebRequest

    Tony Guidici, Oct 27, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    6,843
    Joerg Jooss
    Nov 1, 2003
Loading...

Share This Page