public static string GetCaptchaBase64( int length = 5, CaptchaFormat captchaFormat = CaptchaFormat.Numeric, int width = 120, int height = 50) { return(Convert.ToBase64String(CaptchaManager.GetCaptchaByteArray(length, captchaFormat, width, height))); }
public static Image GetCaptchaImage( int length = 5, CaptchaFormat captchaFormat = CaptchaFormat.Numeric, int width = 120, int height = 50) { CaptchaImage captchaImage = new CaptchaImage(length, captchaFormat, Color.Transparent, width, height); SessionManager.Add("__Captcha__", (object)captchaImage); return((Image)captchaImage.Image); }
public static byte[] GetCaptchaByteArray( int length = 5, CaptchaFormat captchaFormat = CaptchaFormat.Numeric, int width = 120, int height = 50) { Image captchaImage = CaptchaManager.GetCaptchaImage(5, Enums.CaptchaFormat.Numeric, 120, 50); MemoryStream memoryStream = new MemoryStream(); captchaImage.Save((Stream)memoryStream, ImageFormat.Png); return(memoryStream.ToArray()); }