0

I have a form in asp.net containing more than 20 textboxes. I have to use POST method to send only some of the parameters to payment gateway. Is there any way so that only required parameters from the form can be posted to payment gateway? Any help will be appreciated.

1
  • is this asp.net webforms? Or mvc? Commented Mar 1, 2012 at 14:10

3 Answers 3

2

You could either make an explicit post with the values you want e.g. using jQuery (see jQuery.post()) or copy the values to another form that contains only the values of interest and submit that one.

Sign up to request clarification or add additional context in comments.

4 Comments

How can i copy values to another form?
I am looking forward to use Webclient.uploadValues() method. msdn.microsoft.com/en-us/library/9w7b4fz7.aspx
do you want to submit the form from the server or the client? Maybe I misunderstood
Actually in the sample program, they have just given plain html code with all parameters in form with Method = post attribute. So i guess its from client. Correct me if I am wrong.
0

Have you tried just posting ALL your web form elements to the payment gateway? Chances are their page will just use the parameters they are expecting to receive and just ignore the others (that is the default behavior in web pages, interpret what you can and just ignore the rest).

If so, you would just need to make sure the client name of your form elements matches the name of the parameters the payment gateway is expecting to receive.

Since it's a webforms application, you may want to look at How to: Post ASP.NET Web Pages to a Different Page on the MSDN.

4 Comments

ya but the form contains some sensitive information such as password which i feel like need not be posted.
but do you need to "post" at the client side and directly show the resulting page to the client's browser? I'm asking because I've implemented integrations with a couple of payment gateways (of the kind where you redirect the user to a bank's site to perform the payment) and the flow was in both cases: 1. perform a post from the server side (i.e. not from the client's browser to prevent a technically savvy user tampering with the request) 2. receive back (server-side) a form of transaction id from the bank 3. redirect the user to a bank's page to pay for that specific transaction ID
So are you telling that i should post from server side using some c# function and not using javascript or post method from client browser? If so how can i achieve that?
I'm not sure, it depends on the flow that your payment gateway requests. I was asking you to clarify what you needed to do. However, One of the payment gateway integrations I implemented is in c# and open source. The "sendMessage" method here is the one that performs the first (server-side) post
0

input-element without a name-attribute wont be submitted, so just remove the name-attribute on those fields and your fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.