I am trying to connect to a remote sharepoint site through "https" Url using client object model but I am getting the following error:

The underlying connection was closed Could not establish trust relationship for the SSL/TLS secure channel.

Please let me know


  • Which version of the client object model - EMCAScript (JavaScript) or the .NET managed client object model?
    – Ryan
    Feb 28, 2012 at 12:26
  • .net managed client object
    – RHM
    Feb 28, 2012 at 16:39

1 Answer 1


Hope it helps. http://blogs.msdn.com/b/sridhara/archive/2010/10/19/working-with-sharepoint-2010-client-object-model-on-an-ssl-enabled-site.aspx

UPDATE: So you doesn't work in the browser context. As I understand these things when your code works in the browser context and on the SSL-enabled page the browser automatically add a certificate to each your request because for SSL to work the both sides (the client and the server) need to use a certificate. If you create a request to SSL-enabled resource manually outside the browser you need to supply the certificate youself. The *.cer file is the certificate saved to file. You can use simple self-signed certificate. There are several tools to create such a certificate. The code example shows how to add a certificate from the *.cer file to each your request from the managed client object model in SharePoint.

  • what does it mean from the above url: (where it has this) X509Certificate cert = X509Certificate.CreateFromCertFile(@"d:\test.cer");
    – RHM
    Feb 28, 2012 at 16:40
  • 1
    Let's accurate the details - what version of client object model do you use? Javascript? Silverlight? Managed?
    – Alex Boev
    Feb 28, 2012 at 16:44
  • Managed one I am using.
    – RHM
    Feb 28, 2012 at 17:09
  • See the update.
    – Alex Boev
    Feb 28, 2012 at 17:21
  • I see... can you tell me any tool to make certificate?
    – RHM
    Feb 29, 2012 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.