做个 验证码控件 具体代码如下        /// <summary>
        /// 验证码处理
        /// </summary>
        /// <returns></returns>
        public bool CeckCode()
        {
            if (SerialNumber1.CheckSN(this.txtValidation.Text.Trim()))
            {
               return true;
            }
            else
            {
                SerialNumber1.Create();
                return false;
            }
        }
   ---------------------操作--------------------------------
                if (!CeckCode())
                {
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), System.Guid.NewGuid().ToString(),
"alert('验证码错误!')", true);
                    this.SerialNumber1.Create();
                }
                else
                {
                    ...
                 }我自己走调试。
走到if (SerialNumber1.CheckSN(this.txtValidation.Text.Trim()))的时候
我在看监视 this.SerialNumber1.SN="" 怎么弄?
我执行过了this.SerialNumber1.Create();到底怎么办
后台都做完了。
就死在 这个验证码上了。。

解决方案 »

  1.   

    为空这行this.SerialNumber1.Create();
    不执行?
    if (!CeckCode())
      {
      this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), System.Guid.NewGuid().ToString(),
    "alert('验证码错误!')", true);
      return;
      }
      else
      {
      ...
      }这样??
      

  2.   

    我自己走调试。
    走到if (SerialNumber1.CheckSN(this.txtValidation.Text.Trim()))的时候
    我在看监视 this.SerialNumber1.SN="" 怎么弄?
    我执行过了this.SerialNumber1.Create();到底怎么办
    后台都做完了。
    就死在 这个验证码上了。。this.SerialNumber1.SN="" 很明显 没有值
      
      

  3.   

    我知道 没有值。
    但是 创建后 就有值了。。
    然后 走方法走到这步 就没有值了。
                if (SerialNumber1.CheckSN(this.txtValidation.Text.Trim()))
                {
                   return true;
                }
                else
                {
                    SerialNumber1.Create();
                    return false;
                }
    到底为什么啊。。
    我也知道 没有值我想知道 为什么没有值
      

  4.   

    为空这行this.SerialNumber1.Create();
    执行了。            if (!IsPostBack)
                {
                    this.SerialNumber1.Create();
                }走过事件了
      

  5.   

    我的意思 就是 
    SerialNumber1.SN 这个值。总是 莫名其妙 失踪了。也就是消失了。。
      

  6.   

    我用Session..终于给 破了。。