Last post May 20, 2010 11:29 PM by blackcrown
Apr 27, 2010 06:50 AM|raja.s|LINK
The below code helped me to create the simple captcha image dynamically.
If anyone want to know how to create and use captch image for their web application Please see the below code and it will give
some basic Idea about that.
objGraphics.TextRenderingHint = System.Drawing.Text.Btmap objBMP =
Bitmap(100, 40);Graphics objGraphics =
Configure font to use for text
Font objFont =
FontStyle.Regular);string randomStr =
"";char myArray =
is to create the random # and add it to our string
myArray[x] = System.
randomStr += (myArray[x].ToString());
}Random autoRand =
Random();for (x = 0; x < 5; x++)Convert.ToChar(autoRand.Next(65,
90));//This is to add the string to session, to be compared later
Session.Add("RandomStr", randomStr);//' Write out the text
objGraphics.DrawString(randomStr, objFont,Brushes.Red, 10, 8);//' Set the content type
and return the image
Response.ContentType = "image/GIF";
Hope This will help some one to get some Idea about Captcha.
Apr 30, 2010 01:36 AM|idreesbari|LINK
This really niece idea but one thing i want to ask. will we have to save this image on web server or this image will be directly send to client side ?
please elaborate and one thing more please tell what will be its effect of this when we are using ajax, will this automatically updated.
Apr 30, 2010 02:20 AM|raja.s|LINK
We will have to save this image on web server,after that we can use where ever we need.
and i dint have any idea about using Ajax.
Apr 30, 2010 02:24 AM|raja.s|LINK
I used in my website by using Iframe concept.
we need to save on the web server so that only we can use it where ever we need.
I am not having any idea what you are mentioning about AJAX.
May 20, 2010 11:29 PM|blackcrown|LINK
you can use some captcha image ajax control in you asp.net application and it also automatically update its content when the page is refreshed or reload