Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7009565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:52:44+00:00 2026-05-27T21:52:44+00:00

Here’s my scenario: I have one page that collects certain data from the user.

  • 0

Here’s my scenario:

I have one page that collects certain data from the user.
I want to have one button that the user can click, and I want this button to do two things.

a) Log data to my database.
b) Redirect the user to Paypal to make a payment.

My current thought is to create an intermediate “handler” page which will do a) and then redirect the brower to b).

The question is: How do I actually do b)? (Is it some combination of JS and ASP?)
My hope is to have it behave exactly as if the data-collecting page had performed the POST to PayPal directly, but if that is not possible, I welcome other suggestions to implement my scenario.

The back end technology I am using is ASP.NET.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:52:45+00:00Added an answer on May 27, 2026 at 9:52 pm

    After some more specific Googling and testing, the solution that worked out for me was to use the code linked here:

    http://www.codeproject.com/KB/aspnet/ASP_NETRedirectAndPost.aspx

    As you can see … we prepare the POST form which is an HTML form that holds the hidden fields of your POSTed data and a script tag which holds the submit operation of the form .. which will be executed immediately upon the postback.

    private static String PreparePOSTForm(string url, NameValueCollection data)
    {
        //Set a name for the form
        string formID = "PostForm";
        //Build the form using the specified data to be posted.
        StringBuilder f = new StringBuilder();
        f.Append("<form id=\"" + formID + "\" name=\"" + 
                       formID + "\" action=\"" + url + 
                       "\" method=\"POST\">");
    
        foreach (string key in data)
        {
            f.Append("<input type=\"hidden\" name=\"" + key + 
                           "\" value=\"" + data[key] + "\">");
        }
    
        f.Append("</form>");
        //Build the JavaScript which will do the Posting operation.
        StringBuilder s = new StringBuilder();
        s.Append("<script language="'javascript'">");
        s.Append("var v" + formID + " = document." + 
                         formID + ";");
        s.Append("v" + formID + ".submit();");
        s.Append("</script>");
        //Return the form and the script concatenated.
        //(The order is important, Form then JavaScript)
        return f.ToString() + s.ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the situation, i want to have a user that can enter time on
Here is my code (Say we have a single button on the page that
Here's the problem....I have three components...A Page that contains a User Control and a
Here's my scenario - I have an SSIS job that depends on another prior
Here's the scenario: I have a local git repository that mirrors the contents of
Here is my problem...I have a page that loads a list of clients and
Here is the issue I am having: I have a large query that needs
Here is the scenario: I'm writing an app that will watch for any changes
Here is what I want to do. Use this HTML line and have the
Here is my code...I have two dimensional matrices A,B. I want to develop the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.