Ejemplo n.º 1
0
        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"));
        }