1

Recaptcha, webmatrix and SSL problem.

  • Website built on Webmatrix 3.
  • Hosted on “azurewebsites”
  • I understand that there are problems installing recaptcha of SSL. All Azurewebsites protected by SSL.
  • On the Forum, there is nothing specific to Webmatrix and I have been given the RunAround.
  • I did the following and it doesn’t work.


    1- I used NuGet to install reCaptcha Plugin for Net.

2- I already got the public and private key and included them at the top of the page containing the form, and on the _AppStart.cshtml Page.

3- At the top of the form I typed the following;

@if(showRecaptcha == true){
    if(ReCaptcha.PrivateKey != "6Lc4eOwSAAAAAD8Ne6TuMiK0IMmgcm5VCINO-4lq "){
        <p>@ReCaptcha.GetHtml()</p>
        <input type="submit" value="Submit" />
    }
    else {
        <p>  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</p>
    }
}

4- Just before the Submit button I placed the following, containing the public key;

@ReCaptcha.GetHtml("6Lc4eOwSAAAAANOYL-7mkUrEa9MizES_hBOaaY8s", theme: "blue")

 @if (!captchaMessage.IsEmpty()) 
 {
      <label class="validation-error"  >@captchaMessage</label>
 }

5- Just after the “if(IsPost && Validation.IsValid())”, I placed the following:

// Validate the user's captcha answer.  This is the private key.
if (!ReCaptcha.Validate("6Lc4eOwSAAAAAD8Ne6TuMiK0IMmgcm5VCINO-4lq"))           
{
   ModelState.AddError("recaptcha", "Captcha response was not correct");
} 

6- The Recaptcha widget appears intact on the form but the verification fails, because it accepts anything, as if it is not there.

I would really appreciate any help. Joseph.

0

Your Answer

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

Browse other questions tagged or ask your own question.