Guide to implement re-Captcha in DotNetNuke Modules without touching the source code.

If you don’t know what is re-Captcha, this article: What is re-Captcha might help you to get on foot before starting this easy implement guide to install re-CaptCha into your DNN Modules.

DotNetNuke users has long frustrated by the poor design of DotNetNuke Captcha which is has a critical flaw where the Captcha image will be cached in the server and never being refresh if you set the cache the module or the whole page. One of the common error is the DotNetNuke Captcha’s image not showing issue when the DotNetNuke has PageBlaster installed, it is a big trade off for a big site to lack of either one of them.

Despite the advantages of using re-Captcha, it has a big flaw which it has to connect to the internet to have it working properly. Else, let’s get started modifying your modules without the need of the module source code and recompiling them.

Step 1: Register yourself a Key token and download the re-Captcha.

Step 2: Unzip the download file and upload Recaptcha.dll to your DotNetNuke bin folder via FTP. (/httpdocs/bin)

Now the following guide uses Ventrian’s NewsArticle Module for demonstration.

Step 3: Download the ASCX file that handling News Article Comment layout from /DesktopModules/DnnForge – NewsArticles/Controls/PostComment.ascx

Step 4: Open it with an editor and insert the reCAPTCHA control on top of the ASCX file (after Page control)

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="PostComment.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.PostComment" %>
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>

Step 5: Scroll down around line 28 where the default DNN Captcha is called:

<dnn:captchacontrol id="ctlCaptcha" captchawidth="130" captchaheight="40" cssclass="Normal" runat="server" errorstyle-cssclass="NormalRed" />

and insert the reCaptcha after it:

<dnn:captchacontrol id="ctlCaptcha" captchawidth="130" captchaheight="40" cssclass="Normal" runat="server" errorstyle-cssclass="NormalRed" />

Replace the [TOKEN] with the key you get from the registration and That’s it! Now upload and replace the PostComment.ascx and go to NewsArticle Admin Setting to disable the default comment Captcha. However, due to the limitation of not touching the VB files, it is impossible to create some condition like only show reCaptcha to unregister visitors.

However, if you wish to change the reCaptcha design, here’s the guide to customize the reCaptcha design.

Hopefully reCaptcha will be integrated into more DNN modules. Btw, the above method will not work in DotNetNuke Feedback and UserDefinedTable Module due to the way they code the module.