title: Problems with PayPal API Http call
body: <p>I've integrated an option for users to pay via PayPal their online shopping on the web shop that I'm creating. The problem came up suddenly when I started to get this error:  </p>
  
  <pre><code>You must write ContentLength bytes to the request stream before calling [Begin]GetResponse. 
  </code></pre>
  
  <p>And the code for the Http call is as following: </p>
  
  <pre><code>   public string HttpCall(string NvpRequest)
          {
              string url = pEndPointURL;
  
              string strPost = NvpRequest + "&amp;" + buildCredentialsNVPString();
              strPost = strPost + "&amp;BUTTONSOURCE=" + HttpUtility.UrlEncode(BNCode);
  
              HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
              objRequest.Timeout = Timeout;
              objRequest.Method = "POST";
              objRequest.ContentLength = strPost.Length;
  
              try
              {
                  using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()))
                  {
                      myWriter.Write(strPost.ToString());
                  }
              }
              catch (Exception e)
              {
  
              }
  
              //Retrieve the Response returned from the NVP API call to PayPal. 
              HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); // this is the line where the exception occurs...
              string result;
              using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
              {
                  result = sr.ReadToEnd();
              }
  
              return result;
          }
  </code></pre>
  
  <p>Can someone help me out with this? It worked fine a day ago, now its giving me this error? </p>