MY expression checkout works in local environment but getting error in production. Error:
You must provide a request body if you set ContentLength>0 or SendChunked==true. Do this by calling [Begin]GetRequestStream before [Begin]GetResponse. Here My Code: Public Function HttpCall(ByVal NvpRequest As String) As String
'CallNvpServer
Dim url As String = pendpointurl
'To Add the credentials from the profile
Dim codec As New NVPCodec()
Dim strPost As String = (NvpRequest & "&") + buildCredentialsNVPString()
strPost = (strPost & "&BUTTONSOURCE=") + HttpUtility.UrlEncode(BNCode)
'satya
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
'
Dim objRequest As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
objRequest.AllowWriteStreamBuffering = False
objRequest.Timeout = Timeout
objRequest.Method = "POST"
objRequest.ContentLength = strPost.Length
Try
Using myWriter As New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(strPost)
End Using
Catch e As Exception
'
' if (log.IsFatalEnabled)
' {
' log.Fatal(e.Message, this);
' }
End Try
'Retrieve the Response returned from the NVP API call to PayPal
Dim objResponse As HttpWebResponse = DirectCast(objRequest.GetResponse(), HttpWebResponse)
Dim result As String
Using sr As New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
End Using
'Logging the response of the transaction
' if (log.IsInfoEnabled)
' {
' log.Info("Result :" +
' " Elapsed Time : " + (DateTime.Now - startDate).Milliseconds + " ms" +
' result);
' }
'
Return result
End Function
... View more