Nannette Thacker ShiningStar.net

ASP.net Technologies.

Spam Catch without Captcha

By Nannette Thacker

Here is an example of how to set a spam trap without using Captcha. In your web form, typically a Register or Log In page, simply place a hidden textarea field. Then on your form action page, check the value and if it contains any content, you can redirect them to another page or do anything you like. Since a real human won't see or have access to this form field, only the bots will fill in the field.

ASP.net VB Example

<asp:TextBox ID="ReasonCatch" runat="server" 
        Rows="3" Style="display: none;" 
        TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="GoButton" runat="server" Text="Go" 
TabIndex="5" OnClick="GoButton_Click" />

Retrieve

Protected Sub GoButton_Click(ByVal sender As Object, _
            ByVal e As System.EventArgs)
        
        Dim spamtrap As String = ""
        spamtrap = Me.ReasonCatch.Text
        If Not String.IsNullOrEmpty(spamtrap) Then
            Response.Redirect("~/byefool.aspx", False)
        Else
            ' further processing
        End If
        
    End Sub

ASP Classic Example

<textarea id="ReasonCatch" name="ReasonCatch" 
rows="3" cols="4" style="display: none;"></textarea>

Retrieve

    spamtrap = Request.Form("reasoncatch")
	if cstr(spamtrap) <> "" then
		Response.Redirect("/byefool.asp")
	end if 
    

In my actual code, I retrieve the IP address, and send an email to myself with the phrase they sent, along with the IP address, date and time, etc.

This helps to keep these spammers from mucking up your database with garbage records. So far I have caught and stopped a russian website spammer, a geocities spammer, and some really nasty porn links.

I found the original suggestion at the bottom of this page on A CAPTCHA Solution Built With Classic ASP, CSS And Javascript and it works great! I can't tell who the author is from looking at the site, but thanks!

May your dreams be in ASP.net!

Nannette Thacker
"Boy, it sure would be nice if we had some grenades, don't you think?" - Jayne Cobb, Serenity/Firefly

Comments

Wayne said:

Any good bot will try different submission methods of the form and should eventually work out that it can submit without filling out these fields. It still won't stop those that actually write scripts to do multiple submissions on a site by site basis.

# March 18, 2008 5:16 AM

Vimpyboy said:

You should have a default text inside the textbox, or some text next to it. If the browser doesn´t support CSS for some reason (maybe for accessability reasons, the user can be blind and are using a narrator instead), you will see the box.

# March 18, 2008 6:15 AM

ASP.NET said:

Nannette Thacker post an article on &quot;Spam Catch without Captcha&quot;. weblogs.asp.net/nannettethacker

# March 19, 2008 1:56 PM

quitchat said:

Sounds like fun...

I like the byefool page.

Gonna try this later.

:)

# March 20, 2008 5:29 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)