Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am using the following code in my html markup to submit data to the gateway and after that it is redirected to the gateway url.
HTML
<form action="<%= Settings.FormPaymentUrl %>" method="post" id="PayForm"
                           name="PayForm">
                           <input type="hidden" name="VPSProtocol" value="<%= Settings.ProtocolVersion.VersionString() %>" />

                           <input type="hidden" name="TxType" value="<%= Settings.DefaultTransactionType %>" />
                           <input type="hidden" name="Vendor" value="<%= System.Configuration.ConfigurationManager.AppSettings["getvendorname"] %>" />
                           <input type="hidden" name="Crypt" value="<%= Crypt %>" />
                         <input type="image" name="cmdProceed" src="images/proceed.png" alt="Proceed to Form registration" />

                           </form>


But now i want to do same task from the code-behind instead of html markup. i want to post four input hidden fields from code-behind after that it should be redirected to the url. i have tried many things but all in vain.. hope you guyz will help me..
Posted

You can't do this from the server-side. If you want to run some code server-side before going to the payment platform then you can submit a form to your page, that page can do the code then output a blank page with the same form you have above, only you can auto-submit it via javascript (google "auto submit form javascript" if you don't know how) so the user doesn't really see anything, it goes goes to the payment platform.
 
Share this answer
 
Strictly speaking, the question makes no sense, because your HTML does nothing, it does not submit anything to the server, because the "Submit" button is missing; it should be <input> element with the type="submit".

But if I could assume you have it all, your form would submit some data using the method "post". The HTTP request would contain all the form elements' data in key-value pairs, with keys equal to corresponding values of name attributes.

To do the same thing in ASP.NET code behind, you could use the class System.Net.HttpWebRequest:
https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900