コード例 #1
0
ファイル: LoginController.cs プロジェクト: sxycxwb/YRD.MP
        /// <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"));
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        public FileContentResult GetValidateCode()
        {
            ValidateCodeHelper vc = new ValidateCodeHelper();
            string             strValidateCode = vc.CreateValidateCode(4);

            Session["ValidateCode"] = strValidateCode;
            return(File(vc.CreateValidateGraphic(strValidateCode), "image/jpeg"));
        }
コード例 #4
0
        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"));
        }
コード例 #5
0
        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"));
        }
コード例 #6
0
        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"));
        }
コード例 #7
0
        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"));
        }
コード例 #8
0
        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"));
        }
コード例 #9
0
ファイル: LoginService.cs プロジェクト: zyhlzx/LJDAPP
        public byte[] GetVcode()
        {
            string strCode = ValidateCodeHelper.CreateValidateCode(4);

            //验证码放到Session里面去
            SessionHelper.Session[APPKeys.Vercode] = strCode;

            byte[] imgBytes = ValidateCodeHelper.CreateValidateGraphic(strCode);
            return(imgBytes);
        }
コード例 #10
0
        // 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"));
        }
コード例 #11
0
 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);
     }
 }
コード例 #12
0
        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();
        }
コード例 #13
0
        public FileResult getcodeimage()
        {
            var bytes = ValidateCodeHelper.CreateValidateGraphic("4506");

            return(new FileContentResult(bytes, @"image/jpeg"));
        }