c# - 验证 IPN 时 IPN 响应为空

标签 c# paypal paypal-ipn

根据这个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/

相关文章:

paypal - 以编程方式设置 Paypal IPN url

php - Paypal IPN 不断从 Sandbox 返回无效

php - PayPal IPN - PHP 和 MySQL

c# - 如何在 WPF ViewModel 中使用模型验证规则

c# - 自定义模型 Binder 未启动 web api 2

node.js - 什么是 Karken.js 套装,它在多大程度上帮助 Node.js 变得更加安全和可扩展?

php - Paypal单笔付款: How do i know when user accepts payment

暂停和重新激活后的 Paypal 重复配置文件结果

c# - 如何在 C# 和 TPL 中并行处理事件

c# - 事件异常处理