How to Do this on the Server Side in C# [Resolved]

Posted by Vuyiswamb under ASP.NET on 5/17/2011 | Points: 10 | Views : 4263 | Status : [Member] [MVP] [Administrator] | Replies : 1
Good Dal All

i have this aspx page

<%@ Page Language="C#" Async="true" Trace="true" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form runat="server" method="post" action="https://www.vcs.co.za/vvonline/ccform.asp" >
<asp:HiddenField ID="p1" Value="4635" runat="server" />
<asp:HiddenField ID="p2" Value="2" runat="server" />
<asp:HiddenField ID="p3" Value="Some Goods" runat="server" />
<asp:HiddenField ID="p4" Value="5.00" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Pay by Credit Card"
/>
</form>
</body>
</html>



what happens here is that on the Client side when someone clicks the Button it will do the payment and redirect to the page, i want to do this one the server side. i tried this


  protected void btnSubmit_Click1(object sender, EventArgs e)
{

string P1 = p1.Value;

string P2 = p2.Value;

string P3 = p3.Value;

String URl = "https://www.vcs.co.za/vvonline/ccform.asp?p1=" + P1 + "&p2=" + P2 + "&p3=" + P3;
WebClient svc = new WebClient();
svc.UploadStringAsync(new Uri(""), "Post", "AT");
svc.UploadStringCompleted += new UploadStringCompletedEventHandler(svc_UploadStringCompleted);


}


and

void svc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
{
String estr = e.Result;
}


You can test using that URL

Thanks

Thank you for posting at Dotnetfunda
[Administrator]



Responses

Posted by: Vuyiswamb on: 6/13/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down

Resolved
There is nothing wrong with the code, just that the payment gateway did not allow query-string embedded in their URL.


Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response