Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CommonHelper.SetResponseNoCache(Response);

            if (this.Session["CaptchaImageText"] == null)
                this.Session["CaptchaImageText"] = CommonHelper.GenerateRandomDigitCode(6);

            Captcha ci = new Captcha(this.Session["CaptchaImageText"].ToString(), 200, 50, "Century Schoolbook");
            this.Response.Clear();
            this.Response.ContentType = "image/jpeg";
            ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
            ci.Dispose();
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires = 0;
            Response.AddHeader("pragma", "no-cache");

            if (this.Session["CaptchaImageText"] == null)
                this.Session["CaptchaImageText"] = CommonHelper.GenerateRandomDigitCode(6);

            Captcha ci = new Captcha(this.Session["CaptchaImageText"].ToString(), 200, 50, "Century Schoolbook");
            this.Response.Clear();
            this.Response.ContentType = "image/jpeg";
            ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
            ci.Dispose();
        }