Certificate 403 web response

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jojo1771 (Jojo1771_at_discussions.microsoft.com)
Date: 12/08/04


Date: Wed, 8 Dec 2004 13:41:04 -0800

I am baffled, I have a web service doing a ssl connection to a website using
ssl and a certificate that came to me in a p12 format. This code worked
100% in vb.net app but fails to work in service. I keep getting 403
forbidden error when the response like is executed. I have the following
code

    

            strInquiryData = New Uri("https://someite:308")
    ' Build the inquiry string
            sPostData = TransConnect
    ' Dim wreqTU40 As HttpWebRequest =
CType(WebRequest.Create(strInquiryData), HttpWebRequest)

            wreqTU40.Method = "POST"
            wreqTU40.ContentType = "application/x-www-form-urlencoded"

    Dim Certificate As String
            Certificate = "C:\certs\TA.cer"
     Dim cert As X509Certificate =
X509Certificate.CreateFromCertFile(Certificate)

            wrreqTU40.ClientCertificates.Add(cert)

    Dim strInquiry As System.IO.Stream = wreqTU40.GetRequestStream
    'Convert the Post Data to a byte array

    Dim baPostData As Byte() = System.Text.Encoding.ASCII.GetBytes(sPostData)
            strInquiry.Write(baPostData, 0, sPostData.Length)

    'Write the Post Data to the request stream
            strInquiry.Close()
    Dim wresResponse As HttpWebResponse
      
                wresResponse = CType(wreqTU40.GetResponse(),
HttpWebResponse) ‘error happens here

It crashes at the web response area every time with 403 error, what gives? I
have checked the certificate, reinstalled it like 5 times with key and
exported it as der form. I have no other ideas. Does anyone else have one?

Thanks,
Joe



Relevant Pages

  • RE: Problem Accessing web service over SSL
    ... It seems that the SSL connection may ... I successfully exported the certificate to .cer format. ... > My code is using WSE to access the web service. ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: Problem Accessing web service over SSL
    ... set a web reference to the web service using vs.net, I can see all the web ... It seems that the SSL connection may ... I successfully exported the certificate to .cer format. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: WSE 2.0 Policy security settings with multiple X.509 certifica
    ... Certificate Store Location is set to LocalMachine (for the Web Service ... "Trusted Client Certificates" is made from "Local Machine - Other People" ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: Using Microsoft Certificate Server Programatically
    ... Client contacts server (web service) with encrypted registration ... The server issues the certificate (not sure how the web service ...
    (microsoft.public.platformsdk.security)
  • Re: WCF endpoint certificate identity
    ... When web services have certificates involved and are used at the message level I believe the update process would be to re-send the WSDL to the client. ... Some documentation says that "This element specifies a Base64-encoded X.509 certificate value to compare with the client." ... When the web service owner decides to change the certfificate, ...
    (microsoft.public.dotnet.framework.aspnet.webservices)