Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/Png";
            CaptchaTextProvider captchaTextProvider = new CaptchaTextProvider();
            string captchaText = captchaTextProvider.GenerateCaptchaText(5);

            context.Session.Timeout         = 10;
            context.Session["loginCaptcha"] = captchaText;
            context.Response.BinaryWrite(new CaptchaImageProvider().DrawCaptchaImage(captchaText));
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string email       = context.Request.QueryString["email"];
            string type        = context.Request.QueryString["type"];
            string captchaText = new CaptchaTextProvider().GenerateCaptchaText(5);

            if (new EmailSender().SendEmail(captchaText, type, email))
            {
                context.Response.Write("0");
                context.Session.Timeout           = 10;
                context.Session[type + "Captcha"] = captchaText;
            }
            else
            {
                context.Response.Write("1");
            }
        }