Can any one help me in passing the parameters to the worldpay site using mvc http post , below is the example which i found on google , the example is working on view , but I want to pass the parameters through http[post] action controller :
<form method="post" action="https://secure.wp3.rbsworldpay.com/wcc/purchase" id="frmWorldPay">
<input typ开发者_StackOverflow社区e="hidden" name="instId" value="1" />
<input type="hidden" name="cartId" value="<%: Model.CardID %>" />
<input type="hidden" name="currency" value="GBP" />
<input type="hidden" name="amount" value="<%= Model.Cost%> " />
<input type="hidden" name="desc" value="<%: ViewBag.Name %> track day" />
<input type="hidden" name="email" value="<%: Model.aspnet_Users.aspnet_Membership.Email %>" />
<input type="hidden" name="name" value="<%: Model.FullName %>" />
<input type="hidden" name="address" value="<%: Model.Address %>" />
<input type="hidden" name="testMode" value="100" />
Have a look at System.Net.WebClient
.
Also this question on SO may help you further.
edit
You should follow the links I posted. There you find i.e. this example code
using System;
using System.Text;
using System.Net;
using System.Collections.Specialized;
//...
string url = "http://www.amazon.co.uk/exec/obidos/search-handle-form";
NameValueCollection formData = new NameValueCollection();
formData["field-keywords"] = "Harry Potter";
// add more form field / values here
WebClient webClient = new WebClient();
byte[] responseBytes = webClient.UploadValues(url, "POST", formData);
string response = Encoding.UTF8.GetString(responseBytes);
Console.WriteLine(response);
精彩评论