<asp:TextBox runat="server" ></asp:TextBox> 
<img alt="看不清,请点击我!" src="https://www.jb51.net/ChineseCheckCode.aspx" 
style="width: 75px; height: 24px" /> 
<asp:ImageButton runat="server" ImageUrl="~/Images/Login.GIF" 
OnClick="imgBtnLogin_Click" /> 
后台判断
复制代码 代码如下:
 
protected void imgBtnLogin_Click(object sender, ImageClickEventArgs e) 
{ 
HttpCookie cookie = Request.Cookies["CheckCode"]; 
if (cookie.Value == this.Validator.Text.Trim()) 
{ 
//。。。 
} 
else 
{ 
Response.Write("<script>alert('验证码输入错误,请重新输入!');Location='ChineseCodeValidator.aspx'</script>"); 
return; 
} 
} 
以上验证码生成四位,请各位根据 情况做适当修改。
现在总结了生成纯数字、数字字母混合、纯汉字的验证码技术。希望对各位有所帮助。。
您可能感兴趣的文章:
