【发布时间】:2010-12-14 09:16:15
【问题描述】:
背景:我正在实施 Paypal IPN 处理程序。
Paypal 上的这个很棒的 article 声明,在我阅读响应后,我需要向 Paypal 发送 200 OK。
IPN请求的处理如下:
//Send the request to PayPal and get the response
StreamWriter streamOut = new StreamWriter(req.GetRequestStream(),
System.Text.Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd(); //returns VERIFIED
streamIn.Close();
根据以下(来自文章),代码(我猜)应该向 Paypal 发送 200 OK:
PayPal will respond with either VERIFIED or INVALID. After you receive this response, be sure to send 200 OK to prevent additional attempts from PayPal to send an IPN
我没有看到任何明确的 HTTP 响应被发送为“200 OK”。
使用的 HttpWebRequest 会自动发送 200 OK 吗?
如果是,那发生在什么时候?
如果不是,如何使用 HttpWebRequest 发送 200 OK 响应?使用 HttpWebRequest 或套接字更容易做到这一点吗?
【问题讨论】:
-
我不熟悉这个 paypal API,但是 HttpWebRequest 不发送状态。它在发出请求时从服务器接收状态。能否提供您所引用文章的链接?
-
那是哪篇“关于 PayPal 的精彩文章”?
-
抱歉,我忘记粘贴链接了。这里:codeproject.com/KB/aspnet/paypal_c_aspnet.aspx#PostPayment 还编辑了帖子。