示例#1
0
        /// <summary>
        /// 验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult VerifyCode()
        {
            string vcode = CaptchaHelper.CreateRandomCode(4);

            SessionHelper.Set("vcode", vcode);

            return(File(CaptchaHelper.DrawImage(vcode), @"image/jpeg"));
        }
        public ActionResult Vcode()
        {
            var code = CaptchaHelper.CreateRandomCode(4);

            Session["vcode"] = code;
            var img = CaptchaHelper.DrawImage(code, 20, background: Color.White);

            return(File(img, "Image/jpeg"));
        }
示例#3
0
        public void ProcessRequest(HttpContext context)
        {
            string vcode = CaptchaHelper.CreateRandomCode(4);

            context.Session["img_vcode"] = vcode;
            byte[] bs = CaptchaHelper.DrawImage(vcode, 20, Color.White);
            context.Response.ContentType = "image/gif";
            context.Response.BinaryWrite(bs);
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            // 画布  画笔  和  素材
            var vcode = CaptchaHelper.CreateRandomCode(4);

            context.Session["user_vcode"] = vcode;
            var img = CaptchaHelper.DrawImage(vcode, 20, Color.White);

            context.Response.ContentType = "image/gif";
            context.Response.BinaryWrite(img);
        }
示例#5
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            var code = CaptchaHelper.CreateRandomCode(4);

            context.Session["vcode"] = code;

            var img = CaptchaHelper.DrawImage(code, 20, background: Color.White);

            context.Response.ContentType = "image/gif";
            context.Response.BinaryWrite(img);
        }
示例#6
0
        public ActionResult GetVcode(string codelength, string codesize)
        {
            int length;

            if (!int.TryParse(codelength, out length))
            {
                return(Content(JsonReturn(Enum_ReturnStatus.失败, "验证码长度参数错误", null)));
            }
            float size;

            if (!float.TryParse(codesize, out size))
            {
                return(Content(JsonReturn(Enum_ReturnStatus.失败, "验证码字体大小参数错误", null)));
            }
            var code = CaptchaHelper.CreateRandomCode(length);

            Session["zhancaiw_vcode"] = code;
            var img = CaptchaHelper.DrawImage(code, size, background: Color.White);

            return(File(img, "Image/jpeg"));
        }