Home All Groups Group Topic Archive Search About

Consuming Webservice via https

Author
4 Dec 2006 5:21 PM
Jens Mander
Hi and sorry for the heavy crossposting (fu2 mpdf)!

As you might have gotten out of the subject line, my application tries to
consume a webservice that's being connected to via https. This works fine
when I use a windows forms app. Trying the same from within an asp.net app
fails. As far as I can tell this is due to the lack of an installed client
certificate for the ASPNET windows user account. The certificate I use is
available as X.509 (.cer) and as PKCS #7 (.p7b). On MSDN I read an article
that tells how to install an PKCS #12 certificate (.pfx) into the machines
certificate store.

My question is now: How can I connect to the webservice using the
certificate I got?

Any answer is appreciated.

Regards!

Author
7 Dec 2006 4:39 AM
Catalin T
You can use something like this:

// Load the client certificate from a file.
X509Certificate x509 = X509Certificate.CreateFromCertFile(@"c:\user.cer");

// Add the client certificate to the ClientCertificates property of the
proxy class.
webservice.ClientCertificates.Add(x509);


Regards,
Catalin


Show quote
"Jens Mander" wrote:

> Hi and sorry for the heavy crossposting (fu2 mpdf)!
>
> As you might have gotten out of the subject line, my application tries to
> consume a webservice that's being connected to via https. This works fine
> when I use a windows forms app. Trying the same from within an asp.net app
> fails. As far as I can tell this is due to the lack of an installed client
> certificate for the ASPNET windows user account. The certificate I use is
> available as X.509 (.cer) and as PKCS #7 (.p7b). On MSDN I read an article
> that tells how to install an PKCS #12 certificate (.pfx) into the machines
> certificate store.
>
> My question is now: How can I connect to the webservice using the
> certificate I got?
>
> Any answer is appreciated.
>
> Regards!
>
>
>

AddThis Social Bookmark Button