[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

Need to simulate an HTML form submit with action=post from ASP.net 2.0 (vb)

I'm working with a vendor who require I send info through a form post.  I cannot just stick in an asp classic page with a html form as there is some database interaction AFTER the user has completed the form that provides one of the values to be sent.

An earlier question along these lines was well answered and lead me to Webclient which was very helpful (and addressed two other challenges) -

in this case I need to not only submit the data (name-values pairs), but also take the used to the page (with my values in the header) exactly as if the had clicked a submit button on an html form

I want to mimic the functionality of a HTML form like this:
<form id="sas" action="post">
<input id="somekey" name="somekey" type="hidden" value="boo">
<input id="Submit1" type="submit" value="submit" />

but programatically populate the header info and the go there in a server side script.
the  ... Sample code would be great.

Thanks in advance
1 Solution
you could use your webclient to submit the data, and then get its response - this should be exactly what you want your users to see?

you could give that exact page to your users by


this will send the html to your user and stop there so the rest of your aspx page will not be rendered.
goknowsAuthor Commented:
Thanks but I need to actually send the user to the other site - it is a simple credit card paymnt interface and I need to post specific vairable in the header and the 3rd party site will read these and present a form for the user to fill out with the remaining details.  I've done this is classic asp by just haveing a form with method="post" and actoin="https://www.processingsite.com" ... because you cannot use a submit and a method of post on a form in .net, I'm stumped.  I'm thinking about using javascript and a non-server form, but would rather not.

Thanks in advance
I had a similar problem and came up with a very very strange work-around for html forms within asp.net.  Try placing the form inside a table with two rows.  On the first row, place <form></form> and then the next row enter the form you want to process:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <td><form id="sas" action="post">
<input id="somekey" name="somekey" type="hidden" value="boo">
<input id="Submit1" type="submit" value="submit" />

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now