Click here to Skip to main content
15,881,803 members
Articles / Web Development / ASP.NET

Bot-Proof Submission Forms

Rate me:
Please Sign up or sign in to vote.
2.36/5 (5 votes)
3 Apr 2008CPOL5 min read 25.1K   117   17  
The following script makes it difficult for automatic tools to submit forms. The steps involved in this basic script are create a drawing space, allocate colors, fill the background, draw characters, add distortions, and output the image to the browser.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Src="RndImg.ascx" TagName="RndImg" TagPrefix="uc2" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        &nbsp;<asp:ImageButton ID="Image1" runat="server" ImageUrl="a32166g9.gif" />&nbsp;
        <br />
        <uc2:RndImg ID="RndImg1" runat="server" BackgroundDensity="250" AutoBrush="true" DefaultRandomBrush="true" />
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Button ID="Button1"
            runat="server" OnClick="Button1_Click" Text="Go" Width="106px" /><br />
        &nbsp;
    </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Other
Åland Islands Åland Islands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions