Click here to Skip to main content
12,550,447 members (45,348 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#3.0 C# ASP.NET
When I send a request to the paypal using following code lines for authentication,
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("");
StringBuilder URLQueryString = new StringBuilder();
URLQueryString.Append("SUBJECT=Hello this a test&");
objRequest.Method = "POST";
objRequest.ContentLength = URLQueryString.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
I get the following response:


Why is it failing? Please help.

Thank you.
Posted 1-May-11 19:08pm
Updated 1-May-11 21:00pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In your error response you see the following text:


and in your code you have:

objRequest.Method = "POST";

Try changing that line to:

objRequest.Method = "GET";

You're adding querystring variables to the URL, they're generally if not always associated with Http GET.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try this and provide information that are required, replace it with your details

public string GetSubmitUrl()
      StringBuilder url = new StringBuilder();
      url.Append( this.PayPalBaseUrl + "cmd=_xclick&business="+
            HttpUtility.UrlEncode( AccountEmail ) );
      if( BuyerEmail != null && BuyerEmail != "" )
            url.AppendFormat( "&email={0}", HttpUtility.UrlEncode( BuyerEmail ) );
      if (Amount != 0.00M)
            url.AppendFormat("&amount={0:f2}", Amount);
      if( LogoUrl != null && LogoUrl != "" )
            url.AppendFormat( "&image_url={0}", HttpUtility.UrlEncode( LogoUrl ) );
      if( ItemName != null && ItemName != "" )
            url.AppendFormat( "&item_name={0}", HttpUtility.UrlEncode( ItemName ) );
      if( InvoiceNo  != null && InvoiceNo != "" )
            url.AppendFormat( "&invoice={0}", HttpUtility.UrlEncode( InvoiceNo ) );
      if( SuccessUrl != null && SuccessUrl != "" )
            url.AppendFormat( "&return={0}", HttpUtility.UrlEncode( SuccessUrl ) );
      if( CancelUrl != null && CancelUrl != "" )
            url.AppendFormat( "&cancel_return={0}", HttpUtility.UrlEncode( CancelUrl ) );
      return url.ToString();

Hope it helps
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


The error is caused by:


You are not supplying a recent valid version--try something over 62 or ask PayPal for a correct version.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.161021.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100