Click here to Skip to main content
15,885,953 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,
I have one .aspx page and integrating to payment gateway in asp.net.

I have four hidden field and one button control. form tag has action attribute has been set as URL of sagepay and method="post". When I click on button control, server code is not executing and it redirects to sage pay. I need to execute button click event so before redirecting user to sagepay website, I need to store order information in database table.

I already tried with Response.Redirect this one not working.
can anybody know how to fix this issue? Or any other way to integrate sagepay in asp.net.


.aspx page:
<form id="form2" action="https://test/gateway/test.jsp"
method="post">
<input type="hidden" name="VPSProtocol" value="2.23" />
<input type="hidden" name="TxType" value="PAYMENT" />
<input type="hidden" name="Vendor" value="vendorname" />
<input type="hidden" name="Crypt" value="orderInfo" />
<asp:Button ID="btnTest" runat="server" Text="Test SagePay" runat="server" OnClick="onclick_click" />
</form>

Thanks
Nagaraj
Posted

1 solution

ASP.NET
<form id="form1" runat="server" method="post">    
    <asp:button id="btnTest" runat="server" text="Test SagePay" onclick="btnTest_click" xmlns:asp="#unknown" />
</form>


and

C#
protected void btnTest_click(object sender, EventArgs e)
        {
            //Code to save values into DB;
            Response.Redirect("https://test/gateway/test.jsp");
        }


Hope it helps.
 
Share this answer
 
Comments
NAGARAJ N MACHAKNUR 23-Mar-14 3:26am    
As I already mentioned in question Response.Redirect will not post data to gateway. Please read question once again.
CoderPanda 23-Mar-14 3:40am    
Well you didn't mention that you want to post data to Sagepay.

I don't have direct experience with Sagepay, so not sure if they accept query strings etc. But a form's action attribute will post the form before it can go to server side code.
NAGARAJ N MACHAKNUR 23-Mar-14 3:51am    
The gateway will not accept query string. Thanks for your support.

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