Socially Conscious Spam Prevention
I hate spam, though I love getting comments on my blog. CKS:EBE has a feature for spam prevention using CAPTCHA which works well, though months ago I read this post and loved the concept that spam prevention could be socially beneficial. According to the reCAPTCHA site:
“About 60 million CAPTCHAs are solved by humans around the world every day. In each case, roughly ten seconds of human time are being spent. Individually, that’s not a lot of time, but in aggregate these little puzzles consume more than 150,000 hours of work each day. What if we could make positive use of this human effort? reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into “reading” books.”
I decided to extend CKS:EBE to use this valuable service and provide the code (99.99999% of which was NOT written by me) so that others could try it out. Please remember that this is a work in progress and depends on CKS:EBE for the base functionality. Use it at your own risk.
I will be happy to provide my code after I have a chance to test it a bit more. If you cannot wait here is how I did it. BTW, I wanted to include the project in the CKS:EBE framework, so I changed the assembly name and namespace. I suppose you don’t need to do that, but it worked GREAT!
Download the .Net code from the reCAPTCHA site. They have a bunch of examples, I used this one. (Written by Adrian Godong & Ben Maurer)
Open the project and add a reference to CKS:EBE.
Open RecaptchaControl.cs, RecaptchaResponse.cs, and RecaptchaValidator.cs and change the namespace to CKS.EBE.WebControls.
In RecaptchaControl.cs locate the line:
public RecaptchaControl()
this.Enabled = BlogContext.Current.Settings.EnableCaptchaComments;
this.Visible = this.Enabled;
<SafeControl Assembly="CKS.EBE.Recaptcha, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3e8b700c069fb747" Namespace="CKS.EBE.WebControls" TypeName="*" Safe="True" />
<%@ Register TagPrefix="recaptcha" Namespace="CKS.EBE.WebControls" Assembly="CKS.EBE.Recaptcha, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3e8b700c069fb747" %>
<EBE:CaptchaValidator id="idCaptchaValidator" runat="server"
and replace it with:
<recaptcha:RecaptchaControl ID="recaptcha" runat="server" Theme="red" PublicKey="{your public key}" PrivateKey="{your private key}" />
When you browse to your page you should see the reCAPTCHA control:
Test the control to ensure that it is working correctly.
Ready to start your next project with us? That’s great! Give us a call or send us an email and we will get back to you as soon as possible!
+1.512.539.0322