Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i make the captcha refresh autometically ???? please help
XML
this is
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing"%>
<%@ Import Namespace="System.Drawing.Imaging"%>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Random Rand = new Random();
        int intNum = Rand.Next(100000, 999999);

        Bitmap Bmp = new Bitmap(90, 50);

        Graphics Gfx = Graphics.FromImage(Bmp);
        Gfx.Clear(Color.White);

        Font Fnt = new Font("Fandango", 13, FontStyle.Bold);

        Gfx.DrawString(intNum.ToString(), Fnt, Brushes.Red, 15, 15);

        int RandY1 = Rand.Next(0, 50);
        int RandY2 = Rand.Next(0, 50);
        Gfx.DrawLine(Pens.Black, 0, RandY1, 90, RandY2);

        RandY1 = Rand.Next(0, 50);
        RandY2 = Rand.Next(0, 50);
        Gfx.DrawLine(Pens.Black, 90, RandY1, 0, RandY2);

        RandY1 = Rand.Next(0, 50);
        RandY2 = Rand.Next(0, 50);
        Gfx.DrawLine(Pens.Black, 0, RandY1, 90, RandY2);

        Bmp.Save(Response.OutputStream, ImageFormat.Gif);
        Session["VerfiNum"] = intNum;
    }
</script>
<!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>CaptchaImage</title>
</head>
<body>
</body>
</html>
Posted
Updated 16-Jul-11 6:59am
v2
Comments
Uday P.Singh 16-Jul-11 13:30pm    
why would you do that? leave this to user to change the captcha
basma.rashad 16-Jul-11 13:54pm    
iam sorry i don't understand u ??,, i mean if the user enters a wrong captcha it will automatically change
shakil0304003 16-Jul-11 21:18pm    
Unclear!!! what do you want?

1 solution

Why create your own, which is quite likely to be machine readable? Why re-invent the wheel?
Instead, why not use Recaptcha[^] instead? It's free, it's secure, and it helps to get books into electronic format, so it shows you care to your users (those that know about these things, anyway)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900