protected void Page_Load(object sender, EventArgs e) { CaptchaRandomImage CI = new CaptchaRandomImage(); string captchatext = CI.GetRandomString(5); Session["CaptchaText"] = captchatext; CI.GenerateImage(captchatext, 200, 50, Color.DarkGray, Color.White); this.Response.Clear(); this.Response.ContentType = "image/jpeg"; CI.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg); CI.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { CaptchaRandomImage CI = new CaptchaRandomImage(); string captchaText = CI.GetRandomString(5); Session["CaptchaText"] = captchaText; CI.GenerateImage(captchaText, 200, 50, Color.DarkGray, Color.White); this.Response.Clear(); this.Response.ContentType = "image/jpeg"; CI.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg); CI.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { CaptchaRandomImage ci = new CaptchaRandomImage(); // GetRandomString Funtion return random text of your provided characters string captachaText = ci.GetRandomString(5); // GenearteImage funtion return image of the provided text of provided size //ci.GenerateImage(captachaText, 200, 50); // there is a overload function available for set color of the image Session["CaptchaText"] = captachaText; ci.GenerateImage(captachaText, 200, 50, Color.Red, Color.White); this.Response.Clear(); this.Response.ContentType = "image/jpeg"; ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg); ci.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { CaptchaRandomImage CI = new CaptchaRandomImage(); //GetRandomString function returns random text of your provided characters size. string captchaText = CI.GetRandomString(5); //GenerateImage function returns image of the provided text of provided size. //CI.GenerateImage(captchaText, 200, 50); //There is an overloaded function available to set colour of the image. Session["CaptchaText"] = captchaText; CI.GenerateImage(captchaText, 280, 50, Color.DarkGray, Color.White); this.Response.Clear(); this.Response.ContentType = "image/jpeg"; CI.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg); CI.Dispose(); }
public void Captcha_Generating_Method() { CaptchaRandomImage CI = new CaptchaRandomImage(); // GetRandomString Function return random text of your provided characters size string captchaText = CI.GetRandomString(4); //GenearteImage function return image of the provided text of provided size //CI.GenerateImage(captchaText, 200, 50); //there is a overload function available for set color of the image Session["CaptchaText"] = captchaText; CI.GenerateImage(captchaText, 200, 50, Color.Blue, Color.AliceBlue); this.Response.Clear(); this.Response.ContentType = "image/jpeg"; CI.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg); CI.Dispose(); }