Пример #1
0
        public ActionResult GetValidatorGraphics()
        {
            string code = new ValidatorCode().NewValidateCode();

            //采用cookie
            CookiesHelper.SetCookie("ValidatorCode", code);
            byte[] graphic = new ValidatorCode().NewValidateCodeGraphic(code);
            return(File(graphic, @"image/jpeg"));
        }
Пример #2
0
        /// <summary>
        /// 验证码图片
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public byte[] NewValidateCodeGraphic(string code)
        {
            ValidatorCode obj = new ValidatorCode();

            return(obj.CreateValidateGraphic(code));
        }
Пример #3
0
        /// <summary>
        /// 生成验证码数字
        /// </summary>
        /// <param name="id">验证码位数,默认为4</param>
        /// <returns></returns>
        public string NewValidateCode(int id)
        {
            ValidatorCode obj = new ValidatorCode();

            return(obj.CreateValidateCode(id));
        }