Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. trying to submit an httpwebrequest with hidden field and submit button data

trying to submit an httpwebrequest with hidden field and submit button data

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasecomhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 3919049
    wrote on last edited by
    #1

    Hi - I'm implementing PayPal PDT (Payment Data Transfer) for payment confirmations in ASP.NET. I'm going to receive a url post from PayPal with query string parameters. Then I need to send back the form at the bottom of the page. I'd like to implement the form at the bottom as a non-visual HttpWebRequest. So far I have this code: string urlPayPalEnvironment = "https://www.paypal.com/cgi-bin/webscr"; // Prepare web request. HttpWebRequest request = WebRequest.Create(urlPayPalEnvironment) as HttpWebRequest; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; Can you help me extend this code to include the required hidden fields? I've seen code on the web that builds a data string like this: string postData = "cmd=_notify-synch" + "&tx=" + txId + "&at=" + merchantIdentityToken; Is this how HttpWebRequest works internally - hidden fields are simply converted into name-value pairs in a querystring? Also - I'm not sure how the submit input would be added to this. It just has a value of "PDT" in the required form format below with no name. Any ideas on how to handle this? Also - I've seen some examples where the HttpWebRequest just gets streamed out but I'd like an OO approach using the HttpWebResponse to get a handle to the response. Thanks for your help! <form method=post action="https://www.paypal.com/cgi-bin/webscr"> <input type="hidden" name="cmd" value="_notify-synch"> <input type="hidden" name="tx" value="TransactionID"> <input type="hidden" name="at" value="YourIdentityToken"> <input type="submit" value="PDT"> </form>

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups