I am trying to write my own ASP.NET C# handler page for PayPal IPN.
I have followed a number of samples I found on the web but with no success.
I seem to be failing at the first step: capturing the Instant Payment Notification (IPN) data sent to the handler page from PayPal.
I have a web page: PayPalIPNHandler.aspx.cs and in the Page_Load I have the following:
protected void Page_Load(object sender, EventArgs e)
{
byte[] param = Request.BinaryRead(Request.ContentLength);
string strRequest = Encoding.ASCII.GetString(param);
}
I use some sample data to test the handler page:
/sitename/PayPalIPNHandler.aspx?mc_gross=0.01&protection_eligibility=Eligible&address_status=confirmed&item_number1=&payer_id=pid&tax=0.00&address_street=23%20The%20Street&payment_date=12:38:53%20Jan%2010,%202012%20PST&payment_status=Completed&charset=windows-1252&address_zip=IP4%204LP&mc_shipping=0.00&mc_handling=0.00&first_name=John&mc_fee=0.01&address_country_code=GB&address_name=John%20Smith¬ify_version=3.4&custom=&payer_status=unverified&[email protected]&address_country=United%20Kingdom&num_cart_items=1&mc_handling1=0.00&address_city=Ipswich&verify_sign=verify&[email protected]&mc_shipping1=0.00&txn_id=1&payment_type=instant&last_name=Smith&address_state=Suffolk&item_name1=&[email protected]&payment_fee=&quantity1=1&receiver_id=w&txn_type=cart&mc_gross_1=0.01&mc_currency=GBP&residence_country=GB&transaction_subject=Shopping%20Cart&payment_gross=&ipn_track_id=Bu4
However, the ContentLength always seems to be 0 and strRequest is ""
I'm obviously making a very silly mistake, but I just can't see what I'm doing wrong.
Please help.
Kind Regards
Walter