1

任何人都可以帮助我使用 mvc http post 将参数传递给 worldpay 站点,下面是我在 google 上找到的示例,该示例正在查看,但我想通过 http[post] 操作控制器传递参数:

<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" />
4

1 回答 1

5

看看System.Net.WebClient

此外,关于 SO 的这个问题可能会进一步帮助您。

编辑

您应该按照我发布的链接进行操作。在那里你可以找到这个示例代码

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);
于 2011-06-30T09:20:30.867 回答