Reputation: 167
I have strange issue when i post to sage pay from my vb.net application
objHttpRequest = HttpWebRequest.Create(objUri)
objHttpRequest.KeepAlive = False
objHttpRequest.Method = "POST"
objHttpRequest.ProtocolVersion = HttpVersion.Version10
objHttpRequest.ContentType = "application/x-www-form-urlencoded"
arrRequest = objUTFEncode.GetBytes(postValues)
objHttpRequest.ContentLength = arrRequest.Length
objStreamReq = objHttpRequest.GetRequestStream()
objStreamReq.Write(arrRequest, 0, arrRequest.Length)
objStreamReq.Close()
objStreamReq = objHttpRequest.GetRequestStream()
At this line exception is thrown as "The underlying connection was closed: An unexpected error occurred on a send".
When i debug, the connection object is nothing. But i dont know whether it was there before.
It was successfully posted before and i didnt change anything.
I copied the inputs and posted to sage pay with POSTMAN and it succeeds.
Can somebody help me to find this please.
Upvotes: 1
Views: 242
Reputation: 26
Are you using the test server? TLS 1.0 and 1.1 were disabled on it last month so any connections other than TLS 1.2 will fail in that way. The live servers still support 1.0/1.1 until March 31st 2018, so you will need to ensure the client supports TLS 1.2.
You can use TLS 1.2 on .NET 4.0 IF the OS has .NET 4.5+ installed and you manually set the protocol: https://blogs.perficient.com/microsoft/2016/04/tsl-1-2-and-net-support/
Upvotes: 1