I am working on E-Commerce section of my asp.net application,
I have a checkout form in which there is some server controls.
When a customer filled out the checkout form and press submit button all the submitted values are inserted in database and also I want to send the Order Number which is OrderID (Auto Generated Primary Key of my
table) and an Amount to another server (to process the payment transaction) which address is some thing like:
All the things are fine up to insertion in database but the problem is that how can I send the Order Number and Amount from same web form to aforesaid address using post method of FormHtmlControl because my e-merchant
service provider will get these information by using Request.Form(“OrderNo”) Method.
If anyone wants more info. about, just let me know
Dim byteArray
As Byte() = System.Text.Encoding.UTF8.GetBytes(data)
Dim ResponseArray
As Byte() = myWebClient.UploadData(uri, "POST", byteArray)
HttpPost = ResponseArray
End Function
Private Sub Button1_Click(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles Button1.Click
Dim data As
String = "order_number=" + OrderNo.Text + "&total_amount=" + Amt.Text + "&user_name=" + "Samad Patel"
Member
1 Points
64 Posts
Submitting the form to 2 different Servers
Aug 08, 2005 10:06 AM|ASP1979|LINK
I have a checkout form in which there is some server controls.
When a customer filled out the checkout form and press submit button all the submitted values are inserted in database and also I want to send the Order Number which is OrderID (Auto Generated Primary Key of my table) and an Amount to another server (to process the payment transaction) which address is some thing like:
https://ecommerce-xyz.abc.com.uk/mhost/servlet/MerchantManageServlet
All the things are fine up to insertion in database but the problem is that how can I send the Order Number and Amount from same web form to aforesaid address using post method of FormHtmlControl because my e-merchant service provider will get these information by using Request.Form(“OrderNo”) Method.
If anyone wants more info. about, just let me know
Thank you, urgent replay expected
Member
10 Points
332 Posts
Re: Submitting the form to 2 different Servers
Aug 08, 2005 11:05 AM|martinbl|LINK
Hi there,
you could try to post the data manually using the WebClient class.
Here is a function I use to post data:
private byte[] HttpPost(string uri, string data)
{
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Set the content type
myWebClient.Headers.Add("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
// Apply ASCII Encoding to obtain the string as a byte array.
byte[] byteArray = Encoding.UTF8.GetBytes(data);
// Upload the input string using the HTTP 1.0 POST method.
byte[] responseArray = myWebClient.UploadData(uri, "POST", byteArray);
return responseArray;
}
So you could post your data like:
string data = "OrderNo=" + your_Order_No + "&othervar=othervalue&othervar2=othervalue2";
HttpPost("https://ecommerce-xyz.abc.com.uk/mhost/servlet/MerchantManageServlet", data);
analysing the returned array of byte should give you the output generated by the merchand.
Hope this help
Member
1 Points
64 Posts
Re: Submitting the form to 2 different Servers
Aug 09, 2005 05:19 AM|ASP1979|LINK
Function HttpPost(ByVal uri As String, ByVal data As String) As Byte() Dim myWebClient As New System.Net.WebClientPrivate
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(data) Dim ResponseArray As Byte() = myWebClient.UploadData(uri, "POST", byteArray)HttpPost = ResponseArray
End FunctionPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim data As String = "order_number=" + OrderNo.Text + "&total_amount=" + Amt.Text + "&user_name=" + "Samad Patel"
HttpPost("https://ecommerce-uat.cyber.net.pk/mhost/servlet/MerchantControllerServlet", data)
End Subthe problem i am facing is
The underlying connection was closed: Could not establish trust relationship with remote server.
even i upload that page on my remote server
if you want to live check just go to the following URL and enter the following information repectively in the text boxes
http://www.thecambridgeshop.com/checkorder.aspx
in first text box enter : 7055
and in second text box enter : 11.00
you will see the error as i mention you , if my e-merchand testing server is on.
Thanks for you time, i realy appriciate your reply and will on future
Thank you
Member
1 Points
64 Posts
Re: Submitting the form to 2 different Servers
Aug 09, 2005 05:27 AM|ASP1979|LINK
one thing i forget to mention, if you go to
http://www.thecambridgeshop.com/checkorder.html
and enter the information and press the submitt button so it eccept
you can also check the "action" of that from by viewing the source of that form as this is html page
thanks
Member
10 Points
332 Posts
Re: Submitting the form to 2 different Servers
Aug 15, 2005 11:56 AM|martinbl|LINK
What doesn't work so far?
Member
1 Points
64 Posts
Re: Submitting the form to 2 different Servers
Aug 16, 2005 03:29 AM|ASP1979|LINK
Thank you
Member
10 Points
332 Posts
Re: Submitting the form to 2 different Servers
Aug 16, 2005 08:37 AM|martinbl|LINK