/// <summary> /// Enables processing of the result of an action method by a custom type that inherits from <see cref="T:System.Web.Mvc.ActionResult"/>. /// </summary> /// <param name="context">The context within which the result is executed.</param> public override void ExecuteResult(ControllerContext context) { CaptchaImage captchaImage = new CaptchaImage(_characters, Color.White, 175, 50); context.HttpContext.Response.ContentType = @"image/jpg"; context.HttpContext.Response.Expires = 0; captchaImage.Image.Save(context.HttpContext.Response.OutputStream, ImageFormat.Jpeg); }
public void ProcessRequest(HttpContext context) { string word = context.Request["l"]; CaptchaImage captchaImage = new CaptchaImage(word, Color.White, 175, 50); context.Response.ContentType = @"image/jpg"; context.Response.Expires = 0; captchaImage.Image.Save(context.Response.OutputStream, ImageFormat.Jpeg); }