using System;
using System.Collections.Generic;
using System.Linq;
using xabaraCOM;

public partial class InClude_getValidate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string codeType = Request.QueryString["code"];
        int len = (int)xabara.isNum(Request.QueryString["len"]);
        if (len < 1)
        {
            len = 6;
        }

        if (string.IsNullOrEmpty(codeType as string))
        {
            codeType = "123";
        }
        ValidateCode vCodeImg = new ValidateCode();
        string verifyCode = vCodeImg.CreateVerifyCode(codeType, len, 0);
        Session["ImgCode"] = verifyCode;
        System.Drawing.Bitmap bitmap = vCodeImg.CreateImage(verifyCode, false);
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        Response.Clear();
        Response.ContentType = "image/Png";
        Response.BinaryWrite(ms.GetBuffer());
        bitmap.Dispose();
        ms.Dispose();
        ms.Close();
        Response.End();
    }
}
