Esempio n. 1
0
        public FileResult Captcha()
        {
            string num = Core.RandomTo.NumCode(4);

            byte[] bytes = ImageTo.Captcha(num);
            HttpContext.Session.SetString("captcha", Core.CalcTo.MD5(num.ToLower()));
            return(File(bytes, "image/jpeg"));
        }
Esempio n. 2
0
        /// <summary>
        /// 注册验证码
        /// </summary>
        /// <returns></returns>
        public FileResult RegisterCode()
        {
            //生成验证码
            string num = RandomTo.NumCode(4);

            HttpContext.Session.SetString("RegisterCode", num);
            byte[] bytes = ImageTo.Captcha(num);
            return(File(bytes, "image/jpeg"));
        }