.netC#该怎么解决

.netC#
验证码生成,登录分开测试都对,为什么和一起就出错,即使验证码输对了,还是提示错误,请高手明示,新手学习中。这两个是代码图
.netC#该怎么解决.netC#该怎么解决
这个是运行图
.netC#该怎么解决
这个是错误显示
.netC#该怎么解决

------解决方案--------------------
你调试一下,看看text3和yanzm是否一个值
------解决方案--------------------
引用:
你调试一下,看看text3和yanzm是否一个值


界面上面显示的和登陆获取的验证码不一致,
曾经遇到过,每次获得的都是上一次的验证码,你打个断点看看就知道
------解决方案--------------------
个人感觉 你的生成 验证码的代码 不对 、我把 我 写的一个 生成验证码的代码 给你 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;

namespace CheckCode
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:ServerCode runat=server></{0}:ServerCode>")]
    public class ServerCode : WebControl
    {
        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string Text
        {
            get
            {
                String s = (String)ViewState["Text"];
                return ((s == null) ? "[" + this.ID + "]" : s);
            }

            set
            {
                ViewState["Text"] = value;
            }
        }

        protected override void RenderContents(HtmlTextWriter output)
        {
            output.Write(Text);
        }
        public void CreateCode() 
        {
            string chkCode = string.Empty;
            Color[] color = { Color.Black,Color.Red,
                                Color.Blue,Color.Green,
                            Color.Orange,Color.Brown,Color.DarkBlue};
            string[] font = { "Times New Roman","MS Mincho","Book Antiqua",
                            "Gungsuh","PMingLiU","Implact"};
            char[] character = {'2','3','4','5','6','7','8','9',
                               'A','B','C','D','E','F','G','H','J','K','L','M',
                               'N','P','Q','R','S','T','W','X','Y'};
            Random ran = new Random();