How can I get the X509Certificate sent from the client in web service?
<p>I am trying to get client certificate in web service.</p>

<ol>
<li><p>I add client certificate in proxy object and call web method <code>Verify</code>.</p>

<pre><code>private void button2_Click(object sender, EventArgs e)
{
    string certPath = "D:\\test.pfx";
    cert = new X509Certificate2(certPath,"pass");
    Service1 obj = new Service1();
    obj.ClientCertificates.Add(cert);
    textBox2.Text = obj.Verify();
}
</code></pre></li>
</ol>

<p>Web Method in Web Service:</p>

<pre><code>[WebMethod]
public string Verify()
{
    X509Certificate2 cert = new X509Certificate2(Context.Request.ClientCertificate.Certificate);
    bool test = cert.Verify();
    return test.ToString();

}
</code></pre>

<p>In finish with this error:</p>

<pre><code>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&gt; System.Security.Cryptography.CryptographicException: m_safeCertContext is an invalid handle.
</code></pre>

<p>I don't know why. I used <a href="http://stackoverflow.com/questions/894121/how-do-i-get-the-x509certificate-sent-from-the-client-in-web-service">this sample</a>.</p>

<p>I test web service and client on localhost.</p>
