背景:我正在實施Paypal IPN處理程序。HttpWebRequest是否自動發送200 OK?
Paypal上的這個偉大的article指出,在閱讀回覆後,我需要發送200 OK返回PayPal。
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();
根據下面的(從製品),代碼(I猜)應該發送一個200 OK回PayPal:
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不發送狀態。它在發出請求時從服務器接收一個狀態。你能把鏈接指向你參考的文章嗎? – 2009-11-08 15:14:24
哪個「關於貝寶的偉大文章」會是? – AnthonyWJones 2009-11-08 15:14:34
對不起,我忘了粘貼鏈接。在這裏:http://www.codeproject.com/KB/aspnet/paypal_c_aspnet.aspx#PostPayment還編輯了這篇文章。 – Marek 2009-11-08 16:33:41