【发布时间】:2015-04-17 11:23:38
【问题描述】:
以下代码是我们向 sagepay 服务器注册付款的结帐付款页面的一部分。我只需要在发布之前更改编码并在获取响应之后更改解码以符合 AES 要求。
我认为我的 strPost 需要分解为非加密部分和 Crypt 部分是否正确?
在这种情况下,我有一些工作要做。
//** The full transaction registration POST has now been built **
System.Text.UTF8Encoding objUTFEncode = new System.Text.UTF8Encoding();
Uri objUri = new Uri(SagePay.SystemURL(SagePay.ConnectTo, "purchase"));
System.Net.HttpWebRequest objHttpRequest = (HttpWebRequest)WebRequest.Create(objUri.ToString());
objHttpRequest.KeepAlive = false;
objHttpRequest.Method = "POST";
objHttpRequest.ContentType = "application/x-www-form-urlencoded";
byte[] arrRequest = objUTFEncode.GetBytes(strPost);
objHttpRequest.ContentLength = arrRequest.Length;
Stream objStreamReq = objHttpRequest.GetRequestStream();
objStreamReq.Write(arrRequest, 0, arrRequest.Length);
objStreamReq.Close();
//Get response
HttpWebResponse objHttpResponse = (HttpWebResponse)objHttpRequest.GetResponse();
StreamReader objStreamRes = new StreamReader(objHttpResponse.GetResponseStream(), System.Text.Encoding.ASCII);
strResponse = objStreamRes.ReadToEnd();
objStreamRes.Close();
//** No transport level errors, so the message got the SagePay **
//** Analyse the response from VSP Direct to check that everything is okay **
//** Registration results come back in the Status and StatusDetail fields **
strStatus = SagePay.FindField("Status", strResponse);
strStatusDetail = SagePay.FindField("StatusDetail", strResponse);
【问题讨论】:
-
谢谢 Rik。我发现我的服务器实现不需要 AES 部分。我正在运行 https,因此无需进一步加密。看起来只需要一个简单的协议值更改。