1

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 type="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" />
Mr A
  • 6,448
  • 25
  • 83
  • 137

1 Answers1

5

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);
Community
  • 1
  • 1
DanielB
  • 19,910
  • 2
  • 44
  • 50
  • Your question link is in fact a link to MSDN documentation. That's the sort of thing I do! ;-) – Tom Chantler Jun 30 '11 at 09:44
  • Well, I shouldn't have to be more specific. You could simply follow the links and find the answer to your question. For your convenience I pasted a code snippet from one of the links into my answer. – DanielB Jun 30 '11 at 09:57