/// <summary> /// 生成验证码 /// </summary> /// <returns></returns> public ActionResult ValidateCode() { CreateValidateCode createCode = new CreateValidateCode(); string code = createCode.CreateRandomCode(6); Session["ValidateCode"] = code.ToLower(); return(File(createCode.CreateValidateGraphic(code), "images/jpeg")); }
/// <returns></returns> public ActionResult ValidateCode() { CreateValidateCode objCreate = new CreateValidateCode(); string code = objCreate.CreateRandomCode(6); Session["ValidateCode"] = code; return(File(objCreate.CreateValidateGraphic(code), "images/jpeg")); }
/// <summary> /// Add action method, call the method of generating validation code and save the validation code /// </summary> /// <returns></returns> public ActionResult ValidateCode() { CreateValidateCode objCreateCode = new CreateValidateCode(); // Generate validation code string code = objCreateCode.CreateRandomCode(5); TempData["ValidateCode"] = code; // Use TempData to save data( Session mechanism) // Return validation code image return(File(objCreateCode.CreateValidateGraphic(code), "image/Jpeg")); }