ايران ويج

نسخه‌ی کامل: captcha in asp.net
شما در حال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب بندی مناسب.
سلام اگر کسی در مورد captchaچیزی میدونه برام ارسال کنه.ممنون
لینکهای زیر میتونه به شما کمک کنه

کد:
http://www.knowlegezone.com/documents/80/Simple-ASPNET-CAPTCHA-Tutorial/
http://www.c-sharpcorner.com/UploadFile/oguzaltuncu/TextToImageGen08012005023259AM/TextToImageGen.aspx
http://www.codeproject.com/Articles/11224/Simple-Captcha-with-ASP-NET
https://www.google.com/#hl=en&sclient=psy-ab&q=simple+captcha+asp.net&oq=simple+captcha+asp.net&aq=f&aqi=g1g-v1g-b1g-q1&aql=&gs_nf=1&gs_l=hp.3..0j0i15j0i8j0i22.303601.314007.0.314236.49.34.4.1.1.2.924.9277.2-1j14j6j1j1.30.0.x8VWv5UN-80&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=5ef4d94dcb673d
(۰۲-اردیبهشت-۱۳۹۱, ۱۶:۳۱:۳۱)lord_viper نوشته است: [ -> ]لینکهای زیر میتونه به شما کمک کنه

کد:
http://www.knowlegezone.com/documents/80/Simple-ASPNET-CAPTCHA-Tutorial/
http://www.c-sharpcorner.com/UploadFile/oguzaltuncu/TextToImageGen08012005023259AM/TextToImageGen.aspx
http://www.codeproject.com/Articles/11224/Simple-Captcha-with-ASP-NET
https://www.google.com/#hl=en&sclient=psy-ab&q=simple+captcha+asp.net&oq=simple+captcha+asp.net&aq=f&aqi=g1g-v1g-b1g-q1&aql=&gs_nf=1&gs_l=hp.3..0j0i15j0i8j0i22.303601.314007.0.314236.49.34.4.1.1.2.924.9277.2-1j14j6j1j1.30.0.x8VWv5UN-80&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=5ef4d94dcb673d

سلام
ادرس سایت اخر چرا جواب نمی ده؟
اخری ادرس جستجوی من در گوگل هست که اگه مثال بیشتر خواستی بگیری
(۰۲-اردیبهشت-۱۳۹۱, ۱۸:۵۱:۰۲)lord_viper نوشته است: [ -> ]اخری ادرس جستجوی من در گوگل هست که اگه مثال بیشتر خواستی بگیری

سلام
بنده این کد را از سایتی که گفته بودید گرفتم ولی نمی دونم چرا جواب نمیده واین قسمت از کد را هم متوجه نمیشم در ضمن به txtTuring هم error میده ممنون میشم اگه راهنمایی ام کنید.
کد:
I was trying to find a solution to block spammers adding data to our database using C#. This is the quick solution I found.
1.
First create an image tag in the webform that has the submit form.
<IMG height="30" alt="" src="Turing.aspx" width="80">
As you see the source for the picture will be a file called "Turing.aspx".
2.
Later create the webform "Turing.aspx" with the code below :

public class Turing1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Bitmap objBMP =new System.Drawing.Bitmap(60,20);
Graphics objGraphics = System.Drawing.Graphics.FromImage(objBMP);
objGraphics.Clear(Color.Green);
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
//' Configure font to use for text
Font objFont = new Font("Arial", 8, FontStyle.Bold);
string randomStr="";
int[] myIntArray = new int[5] ;
int x;
//That is to create the random # and add it to our string
Random autoRand = new Random();
for (x=0;x<5;x++)
{
myIntArray[x] = System.Convert.ToInt32 (autoRand.Next(0,9));
randomStr+= (myIntArray[x].ToString ());
}
//This is to add the string to session cookie, to be compared later
Session.Add("randomStr",randomStr);
//' Write out the text
objGraphics.DrawString(randomStr, objFont, Brushes.White, 3, 3);
//' Set the content type and return the image
Response.ContentType = "image/GIF";
objBMP.Save(Response.OutputStream, ImageFormat.Gif);
objFont.Dispose();
objGraphics.Dispose();
objBMP.Dispose();
}
}
3.
And this is the code for the submit button on the main form

private void btnSubmit_ServerClick(object sender, System.EventArgs e)
{
if (Page.IsValid && (txtTuring.Value.ToString () ==Session["randomStr"].ToString ()))
{
// The Code to insert data
}
else
{
Label1.Text ="Please enter info correctly";
}
}
بجای txtTurring.value.tostring() اسم txtBox ی که کاربر باید کد کپچا رو توش بنویسه بزار مثلا بنویس textBox1.Text