示例#1
0
        public ActionResult CreateVerifyCode()
        {
            string       code = CaptchaHelper.CreateVerifyCode(4);
            MemoryStream ms   = CaptchaHelper.CreateVerifyCodeImg(code);

            TempData["verifyCode"] = code;
            //Session["verifyCode"] = verifyCode;
            return(File(ms, "image/jpeg"));
        }
示例#2
0
        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult GetVerifyCode()
        {
            string code = CaptchaHelper.CreateVerifyCode(4);

            TempData["verifyCode"] = code;
            var stream = CaptchaHelper.CreateVerifyCodeImg(code);

            return(File(stream, "image/jpeg"));
        }