示例#1
0
        public override void ExecuteResult(ControllerContext context)
        {
            //context.HttpContext.Response.Write("something");

            context.HttpContext.Session["CaptchaImageText"] = ClasesVarias.Generar_Clave();
            // Create a CAPTCHA image using the text stored in the Session object.
            RandomImage ci = new RandomImage(context.HttpContext.Session
                                             ["CaptchaImageText"].ToString(), 300, 75);

            // Change the response headers to output a JPEG image.
            context.HttpContext.Response.Clear();
            context.HttpContext.Response.ContentType = "image/jpeg";
            // Write the image to the response stream in JPEG format.
            ci.Image.Save(context.HttpContext.Response.OutputStream, ImageFormat.Jpeg);
            // Dispose of the CAPTCHA image object.
            ci.Dispose();
        }
        public override void ExecuteResult(ControllerContext context)
        {
            //context.HttpContext.Response.Write("something");

            context.HttpContext.Session["CaptchaImageText"] = ClasesVarias.Generar_Clave();
            // Create a CAPTCHA image using the text stored in the Session object.
            RandomImage ci = new RandomImage(context.HttpContext.Session
                ["CaptchaImageText"].ToString(), 300, 75);
            // Change the response headers to output a JPEG image.
            context.HttpContext.Response.Clear();
            context.HttpContext.Response.ContentType = "image/jpeg";
            // Write the image to the response stream in JPEG format.
            ci.Image.Save(context.HttpContext.Response.OutputStream, ImageFormat.Jpeg);
            // Dispose of the CAPTCHA image object.
            ci.Dispose();

        }