Question Why do I get 403.16 errror on http request?

groadsvb

Well-known member
Joined
Nov 13, 2006
Messages
75
Programming Experience
Beginner
I have a legacy system that is not capable of making the HTTP request over SSL so we wrote an intermediate web service to receive the original HTTP request and then the new webservice makes an HTTP request with the certificate to the other end. I receive the legacy string which is a soap packet and I make the HTTP request to the final and point and I get a success reply text response and then after a couple of seconds I am supposed to get a full text message reply with some useful information. I do get the success but never get the information reply. The other end ( the end we send the http request to) states they are getting a 403 error seen here:

403.16
AcknowledgmentStatus = RETRY Text = The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Exception: The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Inner Exception: The remote server returned an error: (403) Forbidden.


In our iis log we do have this message:

2015-12-04 21:28:10 10.20.20.20 POST /GarResponseService.svc - 443 - 10.20.20.20 - - 403 16 2148204809 349



this is the only code we have the controller that receives the legacy request and make the final http request to the other side.

VB.NET:
       Dim loopctr As Integer = 0
        While loopctr < 3
            Try
                Dim webRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(_url)
                webRequest.Method = "POST"
                webRequest.ContentType = "text/xml; charset=utf-8"
                webRequest.ContentLength = content.Length
                webRequest.ClientCertificates.Add(New X509Certificate2(_certificatePath, _certificatePassword, X509KeyStorageFlags.MachineKeySet))
                webRequest.Timeout = 5000
                webRequest.Headers.Add("SOAPAction", "http://www.uni.com/gar/wsdl/garRequestService/3.0")


                Using sw As New StreamWriter(webRequest.GetRequestStream())
                    sw.Write(content)
                End Using


                Using sr As New System.IO.StreamReader(webRequest.GetResponse().GetResponseStream)
                    Dim data = sr.ReadToEnd
                    Return New ContentResult() With {.Content = data, .ContentType = "text/plain"}
                End Using
            Catch ex As Exception
                loopctr += 1
                If loopctr = 3 Then Throw 
            End Try
            System.Threading.Thread.Sleep(3000)
        End While
        Return New ContentResult() With {.Content = "error thrown", .ContentType = "text/plain"}
 
Last edited:
Back
Top