private void SendErrorImage(HttpContext context, string message)
{
using (Bitmap error_image = new Bitmap(800, 200)) {
Font font = new Font("Arial", 20, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
using (Graphics graphics = Graphics.FromImage(error_image)) {
graphics.Clear(Color.White);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
graphics.DrawString(message, font, new SolidBrush(Color.FromArgb(102, 102, 102)), 0, 0);
graphics.Flush();
}
context.Response.ContentType = "image/jpeg";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Expires = -1;
error_image.Save(context.Response.OutputStream, ImageFormat.Jpeg);
}
}