Click here to Skip to main content
12,396,047 members (65,105 online)
Click here to Skip to main content


597 bookmarked


, 9 Feb 2004 CPOL
Using CAPTCHA images to prevent automated form submission.
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="CaptchaImage._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
		<title>CaptchaImage Test</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="">
		<style type="text/css">
			BODY { FONT-SIZE: 10pt; FONT-FAMILY: sans-serif }
			TD { FONT-SIZE: 10pt; FONT-FAMILY: sans-serif }
			TH { FONT-SIZE: 10pt; FONT-FAMILY: sans-serif }
			.notice { font-size: 90%; }
			.info { FONT-WEIGHT: bold; COLOR: #008000 }
			.error { FONT-WEIGHT: bold; COLOR: #800000 }
		<h2>CaptchaImage Test</h2>
		<p>A demonstration using the <code>CaptchaImage</code> object to prevent automated 
			form submission.</p>
		<form id="Default" method="post" runat="server">
			<img src="JpegImage.aspx"><br>
				<strong>Enter the code shown above:</strong><br>
				<asp:TextBox id="CodeNumberTextBox" runat="server"></asp:TextBox>
				<asp:Button id="SubmitButton" runat="server" Text="Submit"></asp:Button><br>
				<em class="notice">(Note: If you cannot read the numbers in the above<br>
					image, reload the page to generate a new one.)</em>
			<p><asp:Label id="MessageLabel" runat="server"></asp:Label></p>

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.


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


About the Author

Web Developer
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160721.1 | Last Updated 10 Feb 2004
Article Copyright 2004 by BrainJar
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid