Beispiel #1
0
        public IActionResult GetCaptchaImage()
        {
            var test = GlobalContext.ServiceProvider?.GetService <IHttpContextAccessor>().HttpContext.Session.Id;
            Tuple <string, int> captchaCode = CaptchaHelper.GetCaptchaCode();

            byte[] bytes = CaptchaHelper.CreateCaptchaImage(captchaCode.Item1);
            new SessionHelper().WriteSession("CaptchaCode", captchaCode.Item2);
            return(File(bytes, @"image/jpeg"));
        }
        public TData <object> GetCaptchaImage()
        {
            var captchaCode = CaptchaHelper.GetCaptchaCode();
            var bytes       = CaptchaHelper.CreateCaptchaImage(captchaCode.Item1);
            var pic         = Convert.ToBase64String(bytes);
            var result      = captchaCode.Item2;

            var obj = new TData <object>();

            obj.Data = new { pic, result };
            obj.Tag  = 1;

            return(obj);
        }