So after i my self got spammed by a lot of robots on my blog i
browsed the internet to find an easy way to add captcha for the
comment part of my blog.
So i found the easiest way to do was using recaptcha, which can
be found here recaptcha.net. So before we start head over
there and create an account.
Step 1:
Create recaptcha.net account recaptcha.net
Step 2:
Download the .Net package containing the recaptcha.dll
Step 3:
Download from you site frmBlogComment.ascx placed in
siteroot/usercontrols
Step4:
Edit frmBlogComment.ascx
add the following lines
<%@ Import Namespace="Recaptcha">
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha">
void btnSubmit_Click1(object sender, EventArgs args)
{
if (recaptcha.IsValid)
{
btnSubmit_Click(sender,args);
}
}
These lines should be right after the "control tag" "<%@
Control ...... %>"
Futher down you can now add the recaptcha usercontrol
<recaptcha:RecaptchaControl
ID="recaptcha"
runat="server"
PublicKey=...
PrivateKey=....
/>
ofcourse with your privatekey and publickey..
Step 5:
Upload recaptcha.dll to your webroot/bin
Upload the newly edited frmBlogComment.ascx to you
webroot/usercontrols/
And you should be all done and no more bots should spam your
blog I hope.
This post is for them that dont want to recompile umbraco, it
would be a much better solution to add an reference to the
recaptcha.dll