Exemplo n.º 1
0
        public void Create()
        {
            Response.ContentType = "image/gif";
            CaptchaHelper helper = new CaptchaHelper();
            Random        r      = new Random();
            double        d      = r.NextDouble();
            string        text   = FormsAuthentication.HashPasswordForStoringInConfigFile(d.ToString(), "SHA1");
            string        vcode  = text.Substring(4, 5);

            Session["CaptchaCode"] = vcode.ToLower();
            Session.Timeout        = 1;
            Bitmap capthaBmp = helper.Generate(vcode);

            capthaBmp.Save(Response.OutputStream, ImageFormat.Gif);
        }