If you are trying to consume a Sharepoint web service - from a Windows Application - on a server that is configured for both SSL and Require Client Certificate, you need to do the following:
-
First, export the client certifiate to a file following the directions in the section titled: "Step 1: Export the Client Certificate to a File" at this link: http://msdn2.microsoft.com/en-us/library/aa302408.aspx.
- Next you need to tell the web service to use that certificate like this: lists.ClientCertificates.Add(X509Certificate.CreateFromCertFile("C:\file_where_certificate_is_stored_from_above_step");
- Finally (and this is the part that Microsoft left out of their instructions) you need to authenticate to the web service using ONE of the following methods:
- lists.Credentials = CredentialCache.DefaultNetworkCredentials; <-- This uses the credentials of the logged on user.
- CredentialCache cache = new System.Net.CredentialCache(); cache.Add(new Uri(lists.Url), "Basic", new NetworkCredential(UserID, Password, Domain)); lists.Credentials = cache;