Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Reading IPN in ASP.Net Web API (C#)

Hi Folks,

I'm trying to read my FoxyCart IPN in an Web API. I'm getting the form data OK and responding with "foxy", but I'm having trouble decoding and/or decrypting it.

This is what I'm getting and I'm not sure if this is a decryption issue or a decoding issue.......

"C&­á:ý{h¼V¾ÓóÅY†wæK~u4b2ý¶*À Í¡á')1Œž¬Ì‘ÏÈ£ò¿ç(¦XPéÙ€Õ¹D)Eál_ßc“?3P@­!¤zkVØ<‚ˆ3šB(H´­wm‹ùžX…>Ÿ>?V¤…º×À`+;kÀ…BºøCÚÞ¡Ç"UöѲÔM3vÕ¬>Ö

This is my C# controller code and the text above is the value of 'feedDecrypted'
// POST: api/FoxyIPNs
public HttpResponseMessage PostFoxyIPN(HttpRequestMessage request)
var feedFormData = request.Content.ReadAsStringAsync().Result;

//decrypt and decode
byte[] feedBytes = Encoding.ASCII.GetBytes(feedFormData);
string feedUnencoded = HttpUtility.UrlDecode(feedBytes, Encoding.GetEncoding(1252));
string feedDecrypted = RC4.Decrypt(API_KEY, feedUnencoded, false);

//return to calling service. Foxy cart requires a plain string of "foxy" in order to consider the IPN transaction a success.
return new HttpResponseMessage()
Content = new StringContent("foxy")

The annoying thing is that this code is the exact same code that I've used with an older web forms solution which works well. Has anyone done this with Web API specfically.

Sign In or Register to comment.