471,066 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

Certificate 403 web response

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

Nov 23 '05 #1
0 1281

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.