예제 #1
0
        public static byte[] CreateCodeImg()
        {
            string code;

            byte[] img = new CaptchaStyle2().CreateImage(out code);
            System.Web.HttpContext.Current.Session["Captcha"] = code;
            return(img);
        }
예제 #2
0
        /// <summary>
        /// 生成登录验证码
        /// </summary>
        public static void CreateCode()
        {
            string code;

            byte[] img = new CaptchaStyle2().CreateImage(out code);
            System.Web.HttpContext.Current.Session["Captcha"] = code;
            System.Web.HttpContext.Current.Response.ClearContent();
            System.Web.HttpContext.Current.Response.ContentType = "image/Gif";
            System.Web.HttpContext.Current.Response.BinaryWrite(img);
            System.Web.HttpContext.Current.Response.End();
        }