Link to home
Start Free TrialLog in
Avatar of goknows
goknows

asked on

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
Avatar of Solar_Flare
Solar_Flare

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.
Avatar of goknows

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of PAR6
PAR6

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial