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 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()); }