代码之家  ›  专栏  ›  技术社区  ›  AjmeraInfo

验证码图像验证:在C.NET和ASP.NET中[关闭]

  •  5
  • AjmeraInfo  · 技术社区  · 16 年前

    如何使用ASP.NET窗体进行验证码图像验证?

    4 回复  |  直到 16 年前
        1
  •  13
  •   Tim Ferrell    12 年前

    需要注意的几个问题:

    那是在搜索了几分钟之后-我相信你能找到更多。

        3
  •  2
  •   DA.    16 年前

    我先用过这个: http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx

    但机器人程序给我带来了巨大的垃圾邮件问题。到目前为止,使用recaptcha非常有效。

        4
  •  0
  •   Tanmay Nehete    12 年前

    首先从网络下载mscaptcha.dll 在工具栏中导入该dll,并在bin文件夹中添加引用 在ASPX文件中编写以下代码

    <cc1:CaptchaControl ID="CaptchaControl1" runat="server" 
                                         CaptchaBackgroundNoise="Low" CaptchaLength="6" 
                                         CaptchaHeight="60" CaptchaWidth="200" 
                                         CaptchaLineNoise="None" CaptchaMinTimeout="5" 
                                         CaptchaMaxTimeout="240" FontColor="#529E00"/>
    <asp:Label ID="lbl" runat="server" Text="Verification Code *" style="display: inline-block;width: 200px;line-height: 1.8; vertical-align: top; font-size: 12px;font-weight:bold;"></asp:Label>
     <asp:TextBox ID="txtcaptcha" runat="server" Height="22px" Width="325px" style="border: 1px solid #900;"></asp:TextBox>
    

    在代码隐藏文件中写入

    CaptchaControl1.ValidateCaptcha(txtcaptcha.Text.Trim());
         if (CaptchaControl1.UserValidated)
                    {
                        lbierror.ForeColor = System.Drawing.Color.Green;
                        lbierror.Text = "Valid";
                    }
                    else
                    {
                        lbierror.ForeColor = System.Drawing.Color.Red;
                        lbierror.Text = "InValid Captacha";
                    }
    

    我希望 这就行了