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

Posted on 2006-04-12
Last Modified: 2011-09-20

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
Question by:goknows
    LVL 15

    Expert Comment

    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.

    Author Comment

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

    Accepted Solution

    I had a similar problem and came up with a very very strange work-around for html forms within  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

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now