예제 #1
0
        public String GetCaptchaImage()
        {
            int width       = 100;
            int height      = 30;
            var captchaCode = _captcha.GenerateCaptchaCode();
            var result      = _captcha.GenerateCaptchaImage(width, height, captchaCode);

            HttpContext.Session.SetString("CaptchaCode", result.CaptchaCode);
            return(result.CaptchBase64Data);
        }
예제 #2
0
        public IActionResult GetCaptchaImage()
        {
            int width       = 100;
            int height      = 36;
            var captchaCode = _captchaService.GenerateCaptchaCode();
            var result      = _captchaService.GenerateCaptchaImage(width, height, captchaCode);

            HttpContext.Session.SetString("CaptchaCode", result.CaptchaCode);
            Stream s = new MemoryStream(result.CaptchaByteData);

            return(new FileStreamResult(s, "image/png"));
        }