如何在验证码控制中检查条件? [英] how to check the condition in captcha control?

查看:79
本文介绍了如何在验证码控制中检查条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生,
我在ASP.NET中使用验证码控件.在设计页面上,我有文本框,按钮和验证码控件.现在我想要当我在文本框中输入与验证码相同的文本并单击按钮时,请检查输入的文本是否匹配.
所以我想验证一下输入的文本是否与验证码匹配.
如果不匹配,则给出错误消息.

谢谢.

Hello Sir,
I am using Captcha Control in ASP.NET.On design page i have textbox ,button and captcha control. now i want that when i enter the same text as captcha in textbox and click on button than check that entered text is match or not.
So i want to put the validation to check that entered text is match with captcha code.
And if doesn''t match then give an error message.

Thank You.

推荐答案

检查条件.
check condition like that.
protected void Button1_Click(object sender, EventArgs e)
    {
        CaptchaControl1.ValidateCaptcha(TextBox1.Text);
        if (!CaptchaControl1.UserValidated)
        {
            Label1.Text = " not sucessfull";
            return;
        }
        else
        {
            Label1.Text = "Sucessfull";
        }
}


看看以下有关验证码工作原理的文章:
CAPTCHA图像 [简单的ASP.NET CAPTCHA教程 [
Have a look at these articles on how Captcha works:
CAPTCHA Image[^]
Simple ASP.NET CAPTCHA Tutorial [^]

If you are still stuck, post the code, work you did and where you are unable to get it. All you need is to compare and then raise the flag based on the comparison result.


这篇关于如何在验证码控制中检查条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆