Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            VerifyCode v = new VerifyCode();

            v.Length          = this.length;
            v.FontSize        = this.fontSize;
            v.Chaos           = this.chaos;
            v.BackgroundColor = this.backgroundColor;
            v.ChaosColor      = this.chaosColor;
            v.CodeSerial      = this.codeSerial;
            v.Colors          = this.colors;
            v.Fonts           = this.fonts;
            v.Padding         = this.padding;
            string code = v.CreateVerifyCode();                                                    //取随机码

            v.CreateImageOnPage(code, this.Context);                                               // 输出图片

            Response.Cookies.Add(new HttpCookie("CheckCode", CommonTools.Encode(code.ToUpper()))); // 使用Cookies取验证码的值
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            VerifyCode v = new VerifyCode();

                v.Length = this.length;
                v.FontSize = this.fontSize;
                v.Chaos = this.chaos;
                v.BackgroundColor = this.backgroundColor;
                v.ChaosColor = this.chaosColor;
                v.CodeSerial = this.codeSerial;
                v.Colors = this.colors;
                v.Fonts = this.fonts;
                v.Padding = this.padding;
                string code = v.CreateVerifyCode();                //ȡ�����
                v.CreateImageOnPage(code, this.Context);        // ���ͼƬ

                Response.Cookies.Add(new HttpCookie("CheckCode", CommonTools.Encode(code.ToUpper())));// ʹ��Cookiesȡ��֤���ֵ
        }