/// <summary> /// 生成验证码 /// </summary> /// <returns></returns> public ActionResult GetValidateCode() { string code = RandomHelper.GetRandom(4); Session["ValidateCode"] = code; byte[] bytes = ValidateCodeHelper.CreateValidateGraphic(code); return(File(bytes, @"image/jpeg")); }
public ActionResult GetVerifyCode() { string code = string.Empty; byte[] bytes = ValidateCodeHelper.CreateValidateGraphic(out code, 5, 120, 40, 20); Session["ValidateCode"] = code; return(File(bytes, @"image/jpeg")); }
public FileContentResult GetValidateCode() { ValidateCodeHelper vc = new ValidateCodeHelper(); string strValidateCode = vc.CreateValidateCode(4); Session["ValidateCode"] = strValidateCode; return(File(vc.CreateValidateGraphic(strValidateCode), "image/jpeg")); }
public FileResult ValidateCode() { ValidateCodeHelper vCode = new ValidateCodeHelper(); string code = vCode.CreateValidateCode(5); TempData[VALIDATECODE] = code; byte[] bytes = vCode.CreateValidateGraphic(code); return(File(bytes, @"image/jpeg")); }
public ActionResult GetValidateCode() { var vCode = new ValidateCodeHelper(); string code = vCode.CreateValidateCode(4); Session["ValidateCode"] = code; byte[] bytes = vCode.CreateValidateGraphic(code); return(File(bytes, @"image/jpeg")); }
public ActionResult GetValidateCode() { ValidateCodeHelper codeHelper = new ValidateCodeHelper(); string strCode = codeHelper.CreateValidateCode(5); Session[Sessionvalues.LoginValideCode] = strCode; byte[] data = codeHelper.CreateValidateGraphic(strCode); return(File(data, "image/jpeg")); }
public ActionResult VCode() { //引用的都是程序集。需要生成后才会有效果的。 ValidateCodeHelper vCode = new ValidateCodeHelper(); string code = vCode.CreateValidateCodeContainsLetter(4); Session["ValidateCode"] = code; byte[] bytes = vCode.CreateValidateGraphic(code); return(File(bytes, @"image/jpeg")); }
public ActionResult GetValidateCode() { //创建验证码类的对象 ValidateCodeHelper code = new ValidateCodeHelper(); string strCode = code.CreateValidateCode(4);//生成验证码的长度 Session["validateCode"] = strCode; byte[] buffer = code.CreateValidateGraphic(strCode); return(File(buffer, "image/jpeg")); }
public byte[] GetVcode() { string strCode = ValidateCodeHelper.CreateValidateCode(4); //验证码放到Session里面去 SessionHelper.Session[APPKeys.Vercode] = strCode; byte[] imgBytes = ValidateCodeHelper.CreateValidateGraphic(strCode); return(imgBytes); }
// GET: ValidateCode public ActionResult Index() { int width = 120; int height = 40; int fontsize = 18; string code = string.Empty; byte[] bytes = ValidateCodeHelper.CreateValidateGraphic(out code, 4, width, height, fontsize); Session["VCode"] = code; return(File(bytes, @"image/jpeg")); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var valid = new ValidateCodeHelper(); string code = valid.CreateValidateCode(5); Session["validCode"] = code; var ImgCode = valid.CreateValidateGraphic(code); Response.ClearContent(); Response.ContentType = "image/gif"; Response.BinaryWrite(ImgCode); } }
public void ProcessRequest(HttpContext context) { var vCode = new ValidateCodeHelper(); string code = vCode.CreateValidateCode(5); context.Session["ValidateCode"] = code; byte[] bytes = vCode.CreateValidateGraphic(code); MemoryStream ms = new MemoryStream(bytes); Bitmap bitmap = new Bitmap(ms); bitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg); context.Response.ContentType = "image/jpg"; context.Response.End(); }
public FileResult getcodeimage() { var bytes = ValidateCodeHelper.CreateValidateGraphic("4506"); return(new FileContentResult(bytes, @"image/jpeg")); }