How to set recaptcha site key one time for all recaptcha elemments

  • Updated

Normally, if you add the Recaptcha elemment to a form, you need to configure your the SiteKey and SecretKey for that element. If you have a lot of forms and each form needs to add a Recaptcha element, the configuration takes a lot of time and is difficult to manage.

 

There is a simpler way you can do it is to define the RecaptchaSecretKey and RecaptchaSiteKey appsetting in web.config.
 
<add key="RecaptchaSecretKey " value="YOUR_SECRET_KEY" />
<add key="RecaptchaSiteKey " value="YOUR_SITE_KEY" />