locked
Receive Client Certificate in Web Service RRS feed

  • Question

  • User1371153372 posted

    I'm trying to receive a Client Certificate in a Web Service and having some problems.

    Client      

    Dim cert As X509Certificate = X509Certificate.CreateFromCertFile("C:\cert.cer")
    _ws.ClientCertificates.Add(cert)
    Dim hw As String = _ws.HelloWorld
    

    The certificate seems to be correclty loading and added to the client.

    The client connects to the server with HTTPS.

    Server:

     <WebMethod()> _
        Public Function HelloWorld() As String
            Dim cert As HttpClientCertificate = Me.Context.Request.ClientCertificate
            Return "Hello World"
        End Function

    cert.IsPresent is false and all certificate fields are empty.

    IIS is configured to Accept Client Certificates.

    Reproduced in two environments:

    - Windows 7 x64, IIS 7, VS 2008, .NET 3.5

    - XP x86, IIS 5, VS 2008, .NET 3.5

    Always in the Web Service the Client Certificate is not proesent. I haven't been able to find any other configuration I should do. Can anyone help?

    Thanks

    Steve

    Friday, October 15, 2010 12:04 AM

Answers

  • User1716267170 posted

    ("C:\cert.cer")

    "\" is an escape character, and you need to handle the path correctly. Please try to add "@" before the string or use "\\" instead. Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 19, 2010 3:36 AM

All replies

  • User1716267170 posted

    ("C:\cert.cer")

    "\" is an escape character, and you need to handle the path correctly. Please try to add "@" before the string or use "\\" instead. Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 19, 2010 3:36 AM
  • User722377915 posted

    Hi,

    I have the same problem on my machine. I have an asmx web service migrated to .net 4.5 and deployed on IIS and client calling into it by adding a client certificate into the proxy object before invoking the required method.

     

    Any pointers would be useful.

    Tuesday, October 8, 2013 5:03 AM