public FileResult GetValidCode()
        {
            var code = ValidCodeHelper.CreateValidateCode(6);

            //Session[Keys.ValidCode] = code;
            TempData[Keys.ValidCode] = code;
            byte[] buffer = ValidCodeHelper.CreateValidateGraphic(code);//把验证码画到画布
            return(File(buffer, "image/jpeg"));
        }
示例#2
0
        //
        // GET: /Search/

        public ActionResult GetValidateCode()
        {
            ValidCodeHelper vCode = new ValidCodeHelper();
            string          code  = vCode.CreateValidateCode(4);

            Session["ValidateCode"] = code;
            byte[] bytes = vCode.CreateValidateGraphic(code);

            return(File(bytes, @"image/jpeg"));
        }