I've following code to verify Google reCaptcha. This code work without any problem on a regular .NET project (http/https) doesn't matter works fine on both protocols.

But when it comes to a Sharepoint 2013 Visual Webpart UploadValues line gives this error. Tested sites are http and https gives error on both.

The remote certificate is invalid according to the validation procedure.

I tried to put a dummy https url instead of siteverify url and it passes UploadValues line without giving error.

What might be the problem with reCaptcha and Sharepoint Visual Webpart?

FYI: Server has a valid wildcard SSL Certificate which sharepoint sites run with no problem.

using (var wb = new WebClient())
        var data = new NameValueCollection();
        data["secret"] = "MY_SECRET_KEY";
        data["response"] = Page.Request["g-recaptcha-response"];
        byte[] response = wb.UploadValues("https://www.google.com/recaptcha/api/siteverify", "POST", data);
        JObject json = JObject.Parse(Encoding.ASCII.GetString(response));
        Literal1.Text = json.GetValue("success").ToString();

enter image description here

1 Answer 1


Try this:

  1. save google's root certificate from link https://www.google.com/recaptcha/api/

  2. add this cert on Central Administration =>Security =>Manage Trust

  • Thanks for reply, unfortunately it didn't work. I also tried the certificate from pki.google.com but that didn't work too :(
    – Ergec
    May 18, 2018 at 12:40
  • Does it call "Google Trust Services - GlobalSign Root CA-R2"?
    – AlexZh
    May 18, 2018 at 12:47
  • it says Certificate Issuer: CN=Google Internet Authority G3, O=Google Trust Services, C=US Certificate Issued To: CN=www.google.com, O=Google Inc, L=Mountain View, S=California, C=US
    – Ergec
    May 18, 2018 at 12:53
  • It's a site certificate. Go to "Certification Path" tab and take the root cert in tree.
    – AlexZh
    May 18, 2018 at 13:02
  • ah I see, there are two certificates in the path. I was exporting root but when i export the one says google it worked. thanks a lot.
    – Ergec
    May 18, 2018 at 13:15

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.