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" />
</form>

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

Thanks in advance
goknowsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Solar_FlareCommented:
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

Response.Clear()
Response.Write(webclientReturnedHTML)
Response.End()


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
PAR6Commented:
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">
  <tr>
    <td><form></form></td>
  </tr>
  <tr>
    <td><form id="sas" action="post">
<input id="somekey" name="somekey" type="hidden" value="boo">
<input id="Submit1" type="submit" value="submit" />
</form></td>
  </tr>
</table>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.