<%@ WebHandler Language="c#" Class="VerifyImage_WebHandler" Debug="true" %>
using System;
using System.Web;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Configuration;
using Dcx.Common;

public class VerifyImage_WebHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState  //实现这个接口，意味着要实现该接口的两个方法： ProcessRequest和 IsReusable
{

    public void ProcessRequest(HttpContext context)
    {

        Vonle.Model.VerifyImageInfo verifyimg = Dcx.Common.VerifyImage.GenerateImage();
        Bitmap image = verifyimg.Image;

        System.Web.HttpContext.Current.Response.ContentType = verifyimg.ContentType;
        image.Save(context.Response.OutputStream, verifyimg.ImageFormat);

    }
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}
