예제 #1
0
        public ActionResult GetValidatorGraphics()
        {
            ValidatorCodeTools obj = new ValidatorCodeTools();

            string code = obj.CreateValidateCode(5);

            //采用cookie
            CookiesHelper.SetCookie("ValidatorCode", code);
            byte[] graphic = obj.CreateValidateGraphic(code);
            return(File(graphic, @"image/jpeg"));
        }
예제 #2
0
        /// <summary>
        /// 生成验证码数字
        /// </summary>
        /// <param name="id">验证码位数,默认为5</param>
        /// <returns></returns>
        public string NewValidateCode(int id = 5)
        {
            ValidatorCodeTools obj = new ValidatorCodeTools();

            return(obj.CreateValidateCode(5));
        }