public ActionResult Image() { Random random = new Random(); var randomNumber = random.Next(1000, 9999); var df = CoreLogic.GetBytes(randomNumber.ToString()); Request.HttpContext.Session.Set("captcha", df); var captcha = App_Code.CaptchaImage.GenerateImage(randomNumber.ToString(), 80, 150, 30); var jpeg = new FileContentResult(captcha.ToArray(), "image/jpeg"); return(jpeg); }
public JsonResult SetReportParams(string dates, string datef, int classid, int valueid) { JSEnvelope ret = new JSEnvelope(); ret.ReturnObject = false; try { if (Request != null) { if (dates != null && datef != null) { var cid = CoreLogic.ConvertVal(classid); var vid = CoreLogic.ConvertVal(valueid); var ds = CoreLogic.GetBytes(dates); var df = CoreLogic.GetBytes(datef); Request.HttpContext.Session.Set("report_dates", ds); Request.HttpContext.Session.Set("report_datef", df); Request.HttpContext.Session.Set("report_classid", cid); Request.HttpContext.Session.Set("report_valueid", vid); ret.ReturnObject = true; } else { ret.ReturnObject = false; } } } catch (E24Exception e) { ret.Message.IsError = true; ret.Message.MessageText = e.Message; ret.Message.MessageCode = e.ExceptionCode.ToString(); } catch (Exception e) { ret.Message.IsError = true; ret.Message.MessageText = e.Message; } return(Json(ret)); }