如何使用asp.net表单验证验证码?
答案 0 :(得分:13)
答案 1 :(得分:2)
答案 2 :(得分:2)
我先用过这个: http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx
但是我的机器人遇到了大量的垃圾邮件问题。到目前为止,使用ReCaptcha是完美的。
答案 3 :(得分:0)
首先从网上下载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";
}
我希望 这将有效