编辑我误解了这里发生的事情..有一个 POST 发送,然后收到一个结果,然后我在这里看到的 URL 字符串是查询字符串的一部分......所以我无法解码什么这确实是,因为它是由支付网关的人而不是我编码的。
我想解码一个 URL 字符串
这是代码:
private string SubmitXml(string InputXml)
{
string result = InputXml.ToString();
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(_WebServiceUrl);
webReq.Method = "POST";
byte[] reqBytes;
reqBytes = System.Text.Encoding.UTF8.GetBytes(InputXml);
webReq.ContentType = "application/x-www-form-urlencoded";
webReq.ContentLength = reqBytes.Length;
webReq.Timeout = 5000;
Stream requestStream = webReq.GetRequestStream();
requestStream.Write(reqBytes, 0, reqBytes.Length);
requestStream.Close();
HttpWebResponse webResponse = (HttpWebResponse)webReq.GetResponse();
这是 InputXml:
- <GenerateRequest>
<PxPayUserId>KoruCareCHCH_Dev</PxPayUserId>
<PxPayKey>47d99ccdcae54816ecd78c9a80f8878c466a7ed829480e59d421cc4c456cbd93</PxPayKey>
<AmountInput>345.00</AmountInput>
<BillingId />
<CurrencyInput>NZD</CurrencyInput>
<DpsBillingId />
<DpsTxnRef />
<EmailAddress />
<EnableAddBillCard />
<MerchantReference>43</MerchantReference>
<TxnData1 />
<TxnData2 />
<TxnData3 />
<TxnType>Purchase</TxnType>
<TxnId>43</TxnId>
<UrlFail>http://localhost:1527/Auction/PurchaseTickets.aspx</UrlFail>
<UrlSuccess>http://localhost:1527/Auction/PurchaseTickets.aspx</UrlSuccess>
<Opt />
</GenerateRequest>
这是网址
问题:如何将 URL request=blahblah 解码回 XML
我这样做是为了尝试证明 URL 字符串中包含的内容(它应该就像上面的 XML 一样!)