Click here to Skip to main content
15,076,465 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, When its a postback somewere on my page my captha session still has the old value so when the captha get updated on postback the old value is still there

So my textbox value could not be true to the captcha value

What should i do, to clear my Session and take the new value form the captcha?

Here is my code

C#
protected void Button1_Click(object sender, EventArgs e)
      {
          var gettxtimagecode = txtimgcode.Value; // textbox value that the users enter
      check if textbox value == CaptchaText
          if (gettxtimagecode == this.Session["CaptchaImageText"].ToString())
          {

          else
          {
              lblmsg.Text = "Image text is wrong!";
          }
          this.txtimgcode.Value = "";

      }
Posted
Comments
Tushar sangani 22-Dec-14 1:11am
   
Simply set session At Refresh Or Generate New Captcha
Praveen Kumar Upadhyay 22-Dec-14 7:44am
   
Set the Session with the new captcha value where you are generating a new Captcha.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900