【发布时间】:2018-02-26 01:37:23
【问题描述】:
在下面的 HTML 中,代码可以正常工作。
<html>
<head>
<body>
<h1>[http://www.smmotors.org][1]</h1>
<form name="Redirect_to_NetConnect" method="post" action="http://www.smmotors.org/NetConnect">
<input type="hidden" name="Merchant_ID" value="170922010433235"/>
<input type="hidden" name="Order_No" value="1321"/>
<input type="hidden" name="Order_Amount" value="900.00"/>
<input type="hidden" name="Date" value="11/09/2017"/>
<input type="hidden" name="Time" value="21:00:00"/>
<input type="hidden" name="CheckSum" value="6217bd46945786a8ab864943e615f2aa"/>
<input type="hidden" name="Transaction_Desc" value="Shop From SM Motors"/>
<input value="try now" type="submit">
</form>
</body>
</head>
</html>
我想在支付插件(Controllers>HomeControllers.cs)中显示退货页面
public void NetConnect()
{
try
{
HttpClient client = new HttpClient();
var values = new List<KeyValuePair<string, string>>();
values.Add(new KeyValuePair<string, string>("Merchant_ID", "1709022104222235"));
values.Add(new KeyValuePair<string, string>("Order_NO", "1321"));
values.Add(new KeyValuePair<string, string>("Order_Amount", "900.00"));
//values.Add(new KeyValuePair<string, string>("Date", DateTime.Now.ToString("dd/MM/yyyy")));
//values.Add(new KeyValuePair<string, string>("Time", DateTime.Now.ToString("HH:mm:ss")));
values.Add(new KeyValuePair<string, string>("Date", "11/09/2017"));
values.Add(new KeyValuePair<string, string>("Time", "21:00:00"));
values.Add(new KeyValuePair<string, string>("CheckSum", checksum));
values.Add(new KeyValuePair<string, string>("Transaction_Desc", "Shop From SM Motors"));
var content = new FormUrlEncodedContent(values);
var response = client.PostAsync("http://http://www.smmotors.org/NetConnect/NetConnect", content).Result;
var responseString = response.Content.ReadAsStringAsync();
var responseString1 = client.GetStringAsync("http://103.25.136.125/KPALServer/NetConnect.aspx");
}
catch (Exception)
{
throw new Exception();
}
}
我将数据发布到特定 URL 并希望显示返回页面。
返回上面的代码显示空白页。请指导如何显示返回页面。
【问题讨论】:
-
一方面,您的
catch块完全没用。您应该完全删除它,这样您就可以真正看到如果发生异常是什么。除此之外,真正的问题是什么?responseString1不包含您要查找的内容吗?它包含什么?究竟是什么不工作?
标签: c# asp.net asp.net-mvc-4 asp.net-mvc-3 model-view-controller