public ActionResult LoginValidationCode() { string code = ValidationCodeHelper.CreateValidateCode(5); byte[] bytes = ValidationCodeHelper.CreateValidateGraphic(code, 52); CookieHelper.SaveCookie <string>(AuthMgr.LOGIN_VERIFYCODE_COOKIE, code.Trim()); return(File(bytes, @"image/jpeg")); }
public ActionResult LoginValidationCode() { string code = ValidationCodeHelper.CreateValidateCode(5); Session["ValidateCode"] = code; byte[] bytes = ValidationCodeHelper.CreateValidateGraphic(code, 34); CookieHelper.SaveCookie <string>("VerifyCode", code.Trim()); return(File(bytes, @"image/jpeg")); }
public ActionResult LoginValidationCode() { string code = ValidationCodeHelper.CreateValidateCode(5); byte[] bytes = ValidationCodeHelper.CreateValidateGraphic(code, 34); var options = new CookieOptions() { Domain = AppSettings.EnvironmentVariable == "pre" ? "MessageCenter.Pre" : "MessageCenter", HttpOnly = true }; //验证码应该做加密处理,不然形同虚设 HttpContext.Response.Cookies.Append("LoginVerifyCode", HashEncrypt.DESEncrypt(code.Trim(), "hpmcgctr")); return(File(bytes, @"image/jpeg")); }