数据损坏:重新发送Paypal Ipn帖子时

时间:2016-07-14 10:11:37

标签: c# paypal paypal-ipn

我第一次从Paypal接到Ipn电话,它附带的帖子数据很好,我设法处理它,但当我从我的Paypal帐户重新发送Ipn历史记录中的Ipn时,我得到以下内容发布数据

????&cmd=_notify-validate


            string strLive = _varsConfig._payPalDomain + "cgi-bin/webscr";
        ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strLive);


        //Set values for the request back
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
        string strRequest = Encoding.ASCII.GetString(param);
        strRequest += "&cmd=_notify-validate";
        req.ContentLength = strRequest.Length;            

        //for proxy
        //WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
        //req.Proxy = proxy;

        //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();
        streamIn.Close();

0 个答案:

没有答案