F
Fresh_Air_Rider
Hello,
I'm using C# to connect to a payment gateway via the HttpWebRequest
object, but the only sample project supplied by the payment gateway is
written in VB.Net.
Could someone kindly show me the equivalent C# syntax for handling the
-2147012889 error code shown in the VB.Net example code below ?
Obviously C# has no concept of the "Err" object.
Thanks in anticipation.
... ... ...
... ... ...
'Get response
objHttpResponse = objHttpRequest.GetResponse()
objStreamRes = New StreamReader(objHttpResponse.GetResponseStream(),
Encoding.ASCII)
strResponse = objStreamRes.ReadToEnd()
objStreamRes.Close()
If Err.Number <> 0 Then
'** An non zero Err.number indicates an error of some kind **
'** Check for the most common error... unable to reach the purchase
URL **
If Err.Number = -2147012889 Then
strPageError = "Your server was unable to register this
transaction with Sage Pay." & _
" Check that you do not have a firewall restricting the POST and
" & _
"that your server can correctly resolve the address " & SystemURL
(strConnectTo, "puchase")
Else
strPageError = "An Error has occurred whilst trying to register
this transaction.<BR>" & _
"The Error Number is: " & Err.Number & "<BR>" & _
"The Description given is: " & Err.Description
End If
Else
'** No transport level errors, so the message got the Sage Pay **
'** Analyse the response from Direct to check that everything is
okay **
'** Registration results come back in the Status and StatusDetail
fields **
... ... ...
... ... ...
I'm using C# to connect to a payment gateway via the HttpWebRequest
object, but the only sample project supplied by the payment gateway is
written in VB.Net.
Could someone kindly show me the equivalent C# syntax for handling the
-2147012889 error code shown in the VB.Net example code below ?
Obviously C# has no concept of the "Err" object.
Thanks in anticipation.
... ... ...
... ... ...
'Get response
objHttpResponse = objHttpRequest.GetResponse()
objStreamRes = New StreamReader(objHttpResponse.GetResponseStream(),
Encoding.ASCII)
strResponse = objStreamRes.ReadToEnd()
objStreamRes.Close()
If Err.Number <> 0 Then
'** An non zero Err.number indicates an error of some kind **
'** Check for the most common error... unable to reach the purchase
URL **
If Err.Number = -2147012889 Then
strPageError = "Your server was unable to register this
transaction with Sage Pay." & _
" Check that you do not have a firewall restricting the POST and
" & _
"that your server can correctly resolve the address " & SystemURL
(strConnectTo, "puchase")
Else
strPageError = "An Error has occurred whilst trying to register
this transaction.<BR>" & _
"The Error Number is: " & Err.Number & "<BR>" & _
"The Description given is: " & Err.Description
End If
Else
'** No transport level errors, so the message got the Sage Pay **
'** Analyse the response from Direct to check that everything is
okay **
'** Registration results come back in the Status and StatusDetail
fields **
... ... ...
... ... ...