怎样对asp.net中VerifyCode验证码进行验证,谢谢!VerifyCode验证码是用session存储的。我怎样在在aspx页面的page_load中获取VerifyCode验证码,并且与页面的验证码一致
2 回答
![?](http://img1.sycdn.imooc.com/533e52b90001456f02000200-100-100.jpg)
慕森卡
TA贡献1806条经验 获得超8个赞
protected void Page_Load(object sender, EventArgs e) { string VerifyCode=string.Empty; if(null!= Session["VerifyCode"]) { Session["VerifyCode"]=null; VerifyCode=Session["VerifyCode"].ToString().ToLower().Trim(); if(txtVerifyCode.Text.ToLower().Trim()==VerifyCode) { //do... } else { //do... } } else { //do... } }
![?](http://img1.sycdn.imooc.com/533e4c3300019caf02000200-100-100.jpg)
呼如林
TA贡献1798条经验 获得超3个赞
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtVerifyCode.Text) && Session["VerifyCode"] != null)
{
if (txtVerifyCode.Text.Trim().Equals(Session["VerifyCode"].ToString()))
{
//do…
}
}
}
- 2 回答
- 0 关注
- 977 浏览
添加回答
举报
0/150
提交
取消