根据这个paypal document在我们使用 IPN 将消息发送回 Paypal 之后,我们返回:-
如果消息有效,PayPal 将发送一个单字消息,VERIFIED;否则,它将发送另一个单字消息 INVALID。
然而,我时不时地注意到,即使支付成功,响应也可能是空白的。还有其他人注意到这一点吗?
我要验证的代码是:-
var req = (HttpWebRequest)WebRequest.Create(Settings.PayPalPaymentUrl);
//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(Request.ContentLength);
strRequest = Encoding.ASCII.GetString(param);
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;
//Send the request to PayPal and get the response
var streamOut = new StreamWriter(req.GetRequestStream(), Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
var streamIn = new StreamReader(req.GetResponse().GetResponseStream());
strResponse = streamIn.ReadToEnd();
streamIn.Close();
99% 的情况我都得到了 VERIFIED
但我们时不时地看到一条空消息。
最佳答案
如果有人直接访问该页面,而不是被 PayPal 攻击,您会得到一个空白响应,是这样吗?
关于c# - 验证 IPN 时 IPN 响应为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16710092/