Ejemplo n.º 1
0
        /// <summary>
        /// The get response captcha.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        public void GetResponseCaptcha([NotNull] HttpContext context)
        {
#if (!DEBUG)
            try
            {
#endif

            var captchaImage =
                new CaptchaImage(
                    CaptchaHelper.GetCaptchaText(new HttpSessionStateWrapper(context.Session), context.Cache, true),
                    250,
                    50,
                    "Century Schoolbook");
            context.Response.Clear();
            context.Response.ContentType = "image/jpeg";
            captchaImage.Image.Save(context.Response.OutputStream, ImageFormat.Jpeg);
#if (!DEBUG)
        }
        catch (Exception x)
        {
            this.Get <ILogger>().Log(this.Get <IUserDisplayName>().GetName(BoardContext.Current.CurrentUser), this, x);
            context.Response.Write(
                "Error: Resource has been moved or is unavailable. Please contact the forum admin.");
        }
#endif
        }