使用服务器集成和.net,我将原始请求发布到SagePay并获得NextURL,然后转到付款页面......单步执行它们确定,但后来我收到错误:
服务器错误5006:无法重定向到供应商的网站。供应商未能提供RedirectionURL。
HTTP错误500:由于服务器遇到意外情况,请求未成功。
但我我发送一个RedirectionURL(虽然文档调用是RedirectURL,这有点令人困惑 - 无论如何,我已经尝试过使用这两个。这就是我从NotificatioURL发回的内容 - 怎么了?
Dim sb As New StringBuilder
sb.Append("Status=OK")
sb.Append("&StatusDetail=Fine")
sb.Append("&RedirectURL=https://mydomain.co.uk/sagepay.aspx")
Dim urlTEST As String = "https://test.sagepay.com/gateway/service/vspserver-register.vsp"
Dim urlLIVE As String = "https://live.sagepay.com/gateway/service/vspserver-register.vsp"
Try
Dim data As Byte() = Encoding.UTF8.GetBytes(sb.ToString)
Dim request As WebRequest = WebRequest.Create(urlTEST)
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = data.Length
ServicePointManager.ServerCertificateValidationCallback = AddressOf ValidateRemoteSSLCertificate
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim stream = request.GetRequestStream()
stream.Write(data, 0, data.Length)
stream.Close()
Dim response As WebResponse = request.GetResponse()
response.Close()
Catch ex As Exception
'log error
End Try
更新:我收集这个POST(不同于带有购物篮信息的初始版本)要求数据被发送为由CrLf分隔的纯文本键值对,所以我将其修改为
Dim sb As New StringBuilder
sb.AppendLine("Status=OK")
sb.AppendLine("StatusDetail=Fine")
sb.Append("RedirectURL=https://mydomain.co.uk/sagepay.aspx")
但它仍然失败并出现相同的错误。我也尝试使用而不是WebRequst类,更简单:
Dim client As WebClient = New WebClient()
Dim reply As String = client.UploadString(urlTEST, sb.ToString)
但仍然没有快乐。还尝试将request.ContentType更改为“text / plain”,但是nope。
来吧,有人,拜托 - 这对他们的行动来说是基本的,有人必须做到这一点......