详解ASP.NET验证码的生成方法(2)

protected void Button1_Click(object sender, EventArgs e) { if (Request.Cookies["CheckCode"].Value == TextBox1.Text.Trim().ToString()) { Response.Write("Cookies is right"); } else { Response.Write("Cookies is wrong"); } if (Session["CheckCode"] != null) { if (Session["CheckCode"].ToString().ToUpper() == TextBox1.Text.Trim().ToString().ToUpper()) //这样写可以不能区分大小写 { Response.Write("Session is right"); } else { Response.Write("Session is wrong"); } } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjwwwz.html