public FileContentResult CodeImage() { string code = CodeImg.CreateRandomCode(); Session["CodeImg"] = code.ToLower(); return(File(CodeImg.CreateCheckCodeImage(code), "image/jpeg")); }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { if (txtCode.SkinTxt.Text.ToLower() == CodeImg.CodeStr.ToLower()) { Diglog = DialogResult.OK; this.Visible = false; } else { Diglog = DialogResult.No; //刷新验证码 CodeImg.NewCode(); lblErroCode.Visible = true; this.txtCode.SkinTxt.Clear(); this.txtCode.SkinTxt.Focus(); } }
/// <summary> /// 刷新验证码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lblNewCode_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { //刷新验证码 CodeImg.NewCode(); }