protected void Page_Load(object sender, EventArgs e) { //禁用客户端缓存 Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.Expires = 0; Response.CacheControl = "no-cache"; VerifyCode v = new VerifyCode(); v.Length = this.length; v.FontSize = this.fontSize; v.Chaos = this.chaos; v.BackgroundColor = this.backgroundColor; v.ChaosColor = this.chaosColor; v.CodeSerial = this.codeSerial; v.Colors = this.colors; v.Fonts = this.fonts; v.Padding = this.padding; string code = v.CreateVerifyCode(); //取随机码 v.CreateImageOnPage(code, this.Context); // 输出图片 Session["CheckVerifyCode"] = code.ToLower(); // 使用Session["CheckCode"]取验证码的值 //Response.Cookies.Add(new HttpCookie("VerifyCode", code.ToLower()));// 使用Cookies取验证码的值 }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); v.Length = this.length; v.FontSize = this.fontSize; v.Chaos = this.chaos; v.BackgroundColor = this.backgroundColor; v.ChaosColor = this.chaosColor; v.CodeSerial = this.codeSerial; v.Colors = this.colors; v.Fonts = this.fonts; v.Padding = this.padding; string code = v.CreateVerifyCode(); //取随机码 v.CreateImageOnPage(code, this.Context); // 输出图片 // 用于验证的Session //Session["ValidateCode_Page"] = null; //Session["ValidateCode_Page"] = str_ValidateCode; // 使用Cookies取验证码的值 if (LJSheng.Common.LCommon.IsURLName(Request.QueryString["name"])) { Response.Cookies.Add(new HttpCookie(Request.QueryString["name"], code.ToUpper())); // 使用Cookies取验证码的值 } else { Response.Cookies.Add(new HttpCookie("CheckCode", code.ToUpper())); // 使用Cookies取验证码的值 } }
protected void Page_Load(object sender, EventArgs e) { VerifyCode vf = new VerifyCode(); string verifyCode = vf.CreateVerifyCode(4); Session["verifyCode"] = verifyCode; vf.CreateImageOnPage(verifyCode, HttpContext.Current); }
/// <summary> /// 产生验证码 /// </summary> /// <param name="id">The id.</param> /// <param name="d">The d.</param> /// <returns></returns> public ActionResult Vcode(string id, string d) { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(); //取随机码 Session[id] = code; v.Padding = 10; byte[] bytes = v.CreateImage(code); return File(bytes, @"image/jpeg"); }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(); //取随机码 v.CreateImageOnPage(code, this.Context); // 输出图片 // 使用Cookies取验证码的值 Response.Cookies.Add(new HttpCookie("CheckCode", code.ToLower())); }
public ActionResult GetValidateCode() { VerifyCode vCode = new VerifyCode(); string code = vCode.CreateVerifyCode(4); Session["session_verifycode"] = Md5Helper.MD5(code, 16); byte[] bytes = vCode.CreateValidateGraphic(code); return(File(bytes, @"image/jpeg")); }
public FileContentResult GetVerifyCode() { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(); //取随机码 SessionHelper.SetSession("vcode", code); v.Padding = 10; byte[] bytes = v.CreateImage(code); return(File(bytes, @"image/jpeg")); }
// GET: VerifyCode public FileContentResult Index() { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(); //取随机码 Session["vcode"] = code; v.Padding = 10; byte[] bytes = v.CreateImage(code); return(File(bytes, @"image/jpeg")); }
/// <summary> /// 产生验证码 /// </summary> /// <param name="id">The id.</param> /// <param name="d">The d.</param> /// <returns></returns> public ActionResult Vcode(string id, string d) { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(); //取随机码 Session[id] = code; v.Padding = 10; byte[] bytes = v.CreateImage(code); return(File(bytes, @"image/jpeg")); }
public ActionResult Vcode(string d, string id = "") { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode() + ""; //取随机码 Session[iPow.function.Helper.SessionNameLogin] = code; v.Padding = 10; byte[] bytes = v.CreateImage(code); return(File(bytes, @"image/jpeg")); }
// GET: VverifyCode public FileContentResult Index() { var v = new VerifyCode(); var code = v.CreateVerifyCode(); //取随机码 Session["VerifyCode"] = code; v.Padding = 10; var bytes = v.CreateImage(code); return(File(bytes, @"image/jpeg")); }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(4);//验证码长度 v.CreateImageOnPage(code, this.Context); if (!string.IsNullOrEmpty(Request.QueryString["name"])) { Session[Request.QueryString["name"].Trim()] = code; } Session["VerifyCode"] = code; }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode(4);//验证码长度 v.CreateImageOnPage(code, this.Context); if (!string.IsNullOrEmpty(Request.QueryString["name"])) { Session[Request.QueryString["name"].Trim()] = code; } Session["VerifyCode"] = code; }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); v.Length = this.length; v.FontSize = this.fontSize; v.Chaos = this.chaos; v.BackgroundColor = this.backgroundColor; v.ChaosColor = this.chaosColor; v.CodeSerial = this.codeSerial; v.Colors = this.colors; v.Fonts = this.fonts; v.Padding = this.padding; string code = v.CreateVerifyCode(); //取随机码 v.CreateImageOnPage(code, this.Context); // 输出图片 Session["CheckCode"] = code.ToUpper(); //用于客户端校验码比较 }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); v.Length = this.length; v.FontSize = this.fontSize; v.Chaos = this.chaos; v.BackgroundColor = this.backgroundColor; v.ChaosColor = this.chaosColor; v.CodeSerial = this.codeSerial; v.Colors = this.colors; v.Fonts = this.fonts; v.Padding = this.padding; string code = v.CreateVerifyCode(); //取随机码 v.CreateImageOnPage(code, this.Context); // 输出图片 Response.Cookies.Add(new HttpCookie("CheckCode", code.ToUpper())); // 使用Cookies取验证码的值 }
/// <summary> /// 输出验证码 /// </summary> public void Val() { System.IO.MemoryStream ms = new System.IO.MemoryStream(); VerifyCode verify = new VerifyCode(); string code = verify.CreateVerifyCode(); SessionHelper.Add("ValCode", code, 3); Session.Add("ValCode", code); Bitmap image = verify.CreateImageCode(code); image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); Response.ClearContent(); Response.ContentType = "image/gif"; Response.BinaryWrite(ms.GetBuffer()); ms.Close(); ms = null; image.Dispose(); image = null; }
public ImageResult VerifyCodeAction() { VerifyCode v = new VerifyCode(); v.Length = 4; v.FontSize = 20; v.Chaos = true; v.BackgroundColor = Color.White; v.ChaosColor = Color.LightGray; v.CodeSerial = "2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,k,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,K,M,N,P,Q,R,S,T,U,V,W,X,Y,Z"; v.Colors = new Color[] { Color.Black, Color.Red, Color.DarkBlue, Color.Green, Color.Orange, Color.Brown, Color.DarkCyan, Color.Purple }; v.Fonts = new string[] { "Arial", "Georgia" }; v.Padding = 2; string code = v.CreateVerifyCode(); //取随机码 ImageResult res = new ImageResult(code, v); Session["CheckCode"] = code.ToUpper();// 使用Session取验证码的值 return(res); }
protected void Page_Load(object sender, EventArgs e) { VerifyCode v = new VerifyCode(); v.Length = this.length; v.FontSize = this.fontSize; v.Chaos = this.chaos; v.BackgroundColor = this.backgroundColor; v.ChaosColor = this.chaosColor; v.CodeSerial = this.codeSerial; v.Colors = this.colors; v.Fonts = this.fonts; v.Padding = this.padding; string code = v.CreateVerifyCode(); //取随机码 v.CreateImageOnPage(code, this.Context); // 输出图片 Response.Cookies.Add(new HttpCookie("CheckCode", code.ToUpper()));// 使用Cookies取验证码的值 }
public ActionResult Vcode(string d,string id = "") { VerifyCode v = new VerifyCode(); string code = v.CreateVerifyCode() + ""; //取随机码 Session[Miaow.function.Helper.SessionNameLogin] = code; v.Padding = 10; byte[] bytes = v.CreateImage(code); return File(bytes, @"image/jpeg"); }