public ActionResult CaptchaImg() { var builder = new XCaptcha.ImageBuilder(CaptchaHelper.GetRandomStringOnlyNum(6)); var result = builder.Create(); AccountUtil.SetCaptcha(result.Solution); return new FileContentResult(result.Image, result.ContentType); }
public ActionResult CaptchaImg() { var builder = new XCaptcha.ImageBuilder(CaptchaHelper.GetRandomStringOnlyNum(6)); var result = builder.Create(); AccountUtil.SetCaptcha(result.Solution); return(new FileContentResult(result.Image, result.ContentType)); }
// Lay hinh capcha: public ActionResult Image(string d) { var builder = new XCaptcha.ImageBuilder(); var rd = new XCaptcha.RandomTextGenerator(); var result = builder.Create(rd.Create(5, false)); if (Session["xcaptchapii"] == null) Session.Add("xcaptchapii", result.Solution); else Session["xcaptchapii"] = result.Solution; return new FileContentResult(result.Image, result.ContentType); }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { //隨機取得驗證碼數值 var _captcha = this.GetCaptcha(); //建立 XCaptcha 驗證物件 var _builder = new XCaptcha.ImageBuilder(); var _result = _builder.Create(_captcha); //取得驗證碼數值圖片 var _buffer = _result.Image; var _base64 = this.GetBase64Image(_buffer); this.SetCaptchValue(_captcha); this.CaptchaImage.ImageUrl = _base64; } }