TERRANCE FISHER
TERRANCE FISHER

Reputation: 1

IPN Delivery Failed:Cannot extract response: no Content-Type found

IPN Delivery Failed:Cannot extract response: no Content-Type found

Code provided by PayPal.com at "https://cms.paypal.com/uk/cgi-bin/marketingweb?cmd=_render-content&content_ID=developer/library_code_ipn_code_samples"

Dim strSandbox As String = "https://www.sandbox.paypal.com/cgi-bin/webscr"

Dim req As HttpWebRequest = CType(WebRequest.Create(strSandbox), HttpWebRequest)

    'Set values for the request back
    req.Method = "POST"
    req.ContentType = "application/x-www-form-urlencoded"
    Dim Param() As Byte = Request.BinaryRead(HttpContext.Current.Request.ContentLength)
    Dim strRequest As String = Encoding.ASCII.GetString(Param)
    strRequest = strRequest  + "&cmd=_notify-validate"
    req.ContentLength = strRequest.Length

When I run the IPN Simulator :

I get the message: IPN Delivery Failed:Cannot extract response: no Content-Type found

I looked at the StackOverflow where Alex wrote:

Perfect - thanks so much. It's odd that the same code always used to produce the Green tick and "IPN Sent Successfully" using the old simulator. Anyway, I shoved the following code before I send the IPN back: Response.Clear(); Response.StatusCode = 200; Response.Write(""); Response.End(); This seemed to do the trick. Guess I didn't read the manual properly, after all. – Alex Mar 15 at 9:04

Didn't work for me.

9/18 Does anyone have any ideas?

Upvotes: 0

Views: 428

Answers (1)

Mike Stimpson
Mike Stimpson

Reputation: 61

I've just had this exact problem. Response.Write("") fails, but changing it to "\r\n" works. This is the full code I'm using in my IPN handler:

        Response.Clear();
        Response.StatusCode = 200;
        Response.Write("\r\n");
        Response.End();

Upvotes: 0

Related Questions