HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/MBoogaard/oosting-horseriding.com/wwwroot/CMSPages/Dialogs/CaptchaImage.aspx.cs
using System;
using System.Drawing.Imaging;
using System.Web;
using System.Web.UI;

using CMS.Helpers;
using CMS.UIControls;

public partial class CMSPages_Dialogs_CaptchaImage : Page
{
    #region "Constants"

    private const int MAXSIDESIZE = 2000;

    #endregion


    #region "Methods"

    protected void Page_Load(object sender, EventArgs e)
    {
        string captcha = QueryHelper.GetString("captcha", "");
        int width = QueryHelper.GetInteger("width", 80);
        if (width > MAXSIDESIZE)
        {
            width = MAXSIDESIZE;
        }
        int height = QueryHelper.GetInteger("height", 20);
        if (height > MAXSIDESIZE)
        {
            height = MAXSIDESIZE;
        }

        if (WindowHelper.GetItem("CaptchaImageText" + captcha) != null)
        {
            bool useWarp = QueryHelper.GetBoolean("useWarp", true);

            // Create a CAPTCHA image using the text stored in the Session object.
            CaptchaImage ci = new CaptchaImage(WindowHelper.GetItem("CaptchaImageText" + captcha).ToString(), width, height, null, useWarp);

            // Change the response headers to output a JPEG image.
            Response.Clear();
            Response.ContentType = "image/jpeg";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            // Write the image to the response stream in JPEG format.
            ci.Image.Save(Response.OutputStream, ImageFormat.Jpeg);

            // Dispose of the CAPTCHA image object.
            ci.Dispose();

            RequestHelper.EndResponse();
        }
    }

    #endregion
}