title: Paypal IPN returns INVALID response
body: <pre><code>{Following is the vb.net code for IPN listener:
      If Me.TestMode = True Then
              Me.RequestUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr"
          Else
              Me.RequestUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr" '"https://www.paypal.com/cgi-bin/webscr"
          End If
  
  
  
          '====================================Test======================================'
          Dim startTime As String = String.Format("{0:MM-dd-yyyy hh:mm:ss:tt}", Now)
          '=============================================================================='
  
          Dim req As HttpWebRequest = CType(WebRequest.Create(Me.RequestUrl), HttpWebRequest)
          req.Method = "POST"
          req.ContentType = "application/x-www-form-urlencoded"
          Dim Param() As Byte = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.ContentLength)
          Dim strRequest As String = Encoding.ASCII.GetString(Param)
          strRequest = strRequest &amp; "&amp;cmd=_notify-validate"
          req.ContentLength = strRequest.Length
          ' Dim pairs() As String = strRecieved.Split("&amp;")
          Using streamOut As StreamWriter = New StreamWriter(req.GetRequestStream(), Encoding.ASCII)
              streamOut.Write(strRequest.ToString)
              streamOut.Close()
          End Using
          Dim streamIn As StreamReader = New StreamReader(req.GetResponse().GetResponseStream())
          Dim strResponse As String = streamIn.ReadToEnd()
          streamIn.Close()
          WriteLog(strResponse)
  </code></pre>
  
  <p>I have done code for paypal IPN listener in vb.net . When I test that url with paypal sandbox account, it shows following message:
  "IPN successfully sent."
  But when I check my log file on server, then it shows INVALID response from paypal sandbox url. Without VALID response my other code will not work. 
  Please help!!</p>