Websevice secured with X509 cert (ssl)

B

Bat'on

Hi,

I try to consume a webservice. In order to see it in IE, I needed to install
(provided) X509 certs (I got 2 of them) When I try to open that page
in IE, I'm being asked which cert I want to use, and page opens.

Now when I try to add webreference in VS2K3, after i type url in that
wizzard, I'm asked again to choose a cert. Then wsdl appears, but on
the right side of the wizzard ("Web services found at that url") I see:

There was an error downloading 'https://url/name.asmx?WSDL'.

The request failed with HTTP status 403: Forbidden.

Any chance to fix that?

Second question. OK, I managed to add a webreference to other WS
with the same WSDL, than I change url to that of secured webserwice.

test.Url = "https://secured_url/";

and add cert to client certificates using:

test.ClientCertificates.Add(X509Certificate.CreateFromSignedFile(@"C:\test.pfx");

But I still get:

System.Net.WebException: The request failed with HTTP status 403: Forbidden.

:-( Any hint? What am I doing wrong?

Bat
 
B

Bat'on

Bat'on said:
Hi,

I try to consume a webservice. In order to see it in IE, I needed to install
(provided) X509 certs (I got 2 of them) When I try to open that page
in IE, I'm being asked which cert I want to use, and page opens.

Now when I try to add webreference in VS2K3, after i type url in that
wizzard, I'm asked again to choose a cert. Then wsdl appears, but on
the right side of the wizzard ("Web services found at that url") I see:

There was an error downloading 'https://url/name.asmx?WSDL'.

The request failed with HTTP status 403: Forbidden.

Any chance to fix that?

Second question. OK, I managed to add a webreference to other WS
with the same WSDL, than I change url to that of secured webserwice.

test.Url = "https://secured_url/";

and add cert to client certificates using:

test.ClientCertificates.Add(X509Certificate.CreateFromSignedFile(@"C:\test.pfx");

But I still get:

System.Net.WebException: The request failed with HTTP status 403: Forbidden.

:-( Any hint? What am I doing wrong?

OK, I know now what I was doing wrong. CreateFromSignedFile fails to create
a cert without any notice. Neither it throws an exception, nor returns null.
Its a
cert with all fields undefined or null (except from type, witch is set to
"X509" :)

CreateFromSignedFile does it even if that file could not be found :D

I switched to CreateFromCertFile, exported that cerificate to "cer" file
and it works now...

Bat
 
J

JerryK

Bat'on said:
OK, I know now what I was doing wrong. CreateFromSignedFile fails to
create
a cert without any notice. Neither it throws an exception, nor returns
null.
Its a
cert with all fields undefined or null (except from type, witch is set to
"X509" :)

CreateFromSignedFile does it even if that file could not be found :D

I switched to CreateFromCertFile, exported that cerificate to "cer" file
and it works now...

Bat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top