Exemplo n.º 1
0
        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult yzm()
        {
            ValidateCodeHelper vch  = new ValidateCodeHelper();
            string             code = vch.GetRandomNumberString(4);

            Tools.WriteCookie("loginCode", code, 2);
            return(File(vch.CreateImage(code), "image/jpeg"));
        }
Exemplo n.º 2
0
        public FileResult ValidateCode()
        {
            ValidateCodeHelper validateCode = new ValidateCodeHelper();
            string             code         = validateCode.GetRandomNumberString(4);

            TempData[VALIDATECODE] = code;
            byte[] bytes = validateCode.CreateImage(code);
            return(File(bytes, @"image/jpeg"));
        }