Пример #1
0
        /// <summary>
        /// 获取验证码图片
        /// </summary>
        /// <returns></returns>
        public ActionResult GetValidateCode()
        {
            Common.ValidateCode validateCodeModule = new Common.ValidateCode();
            string code = validateCodeModule.CreateValidateCode(6);

            OA.Common.SessionOperater.SetValue("ValidateCode", code);
            return(File(validateCodeModule.CreateValidateGraphic(code), "image/jpeg"));
        }
        /// <summary>
        /// 验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult ValidateCode()
        {
            Common.ValidateCode validate = new Common.ValidateCode();
            var code = validate.CreateValidateCode(4);

            TempData["code"] = code;
            return(File(validate.CreateValidateGraphic(code), "image/jpg"));
        }
Пример #3
0
        public ActionResult ValidateCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            byte[] buffer = validateCode.CreateValidateGraphic(code);
            return(File(buffer, "image/jpeg"));
        }
Пример #4
0
        public void ProcessRequest(HttpContext context)
        {
            Common.LaomaPager.ShowPageNavigate(1, 1, 1);
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            context.Session["vcode"] = code;
            validateCode.CreateValidateGraphic(code, context);
        }
Пример #5
0
        public ActionResult ShowValidateCode()
        {
            Common.ValidateCode vliateCode = new Common.ValidateCode();
            string code = vliateCode.CreateValidateCode(4);//产生验证码

            Session["validateCode"] = code;
            byte[] buffer = vliateCode.CreateValidateGraphic(code);//将验证码画到画布上.
            return(File(buffer, "image/jpeg"));
        }
Пример #6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            Common.ValidateCode code = new Common.ValidateCode();
            string yzm = code.CreateValidateCode(4);

            context.Session.Add("vcode", yzm);
            code.CreateValidateGraphic(yzm);
        }
Пример #7
0
        public ActionResult ShowValidateCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            Session["validateCode"] = code;
            byte[] buffer = validateCode.CreateValidateGraphic(code);//把验证码画在画布上并转为Byte字节
            return(File(buffer, "image/jpeg"));
        }
Пример #8
0
        public ActionResult verification()
        {
            Common.ValidateCode validate = new Common.ValidateCode();
            string code = validate.CreateValidateCode(4).ToUpper();

            Session[Utility.globalValue.SESSION_VERIFY_CODE] = code;
            Byte[] buffer = validate.CreateValidateGraphic(code);
            return(File(buffer, "image/jpeg"));
        }
Пример #9
0
        //在一般处理程序中如果要使用Session必须实现.IRequiresSessionState接口.
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            context.Session["validateCode"] = code;
            validateCode.CreateValidateGraphic(code, context);
        }
Пример #10
0
        //获取验证码
        public ActionResult Get()
        {
            Common.ValidateCode ValidateCode = new Common.ValidateCode();
            string code = ValidateCode.CreateValidateCode(4);//生成验证码,传几就是几位验证码

            Session["code"] = code;
            byte[] buffer = ValidateCode.CreateValidateGraphic(code);//把验证码画到画布
            return(File(buffer, "image/jpeg"));
        }
Пример #11
0
        /// <summary>
        /// 返回验证码图片
        /// </summary>
        /// <returns>验证码图片</returns>
        public ActionResult ShowValidateCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);//获取验证码.

            Session["code_regist"] = code;
            byte[] buffer = validateCode.CreateValidateGraphic(code);
            return(File(buffer, "image/jpeg"));
        }
Пример #12
0
        public void ProcessRequest(HttpContext context)
        {
            //用来校验用户输入的验证码
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            context.Session["Vcode"] = code;
            validateCode.CreateValidateGraphic(code, context);
        }
Пример #13
0
        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowValidateCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            Session["ValidateCode"] = code;
            byte[] codeImgBuffer = validateCode.CreateValidateGraphic(code);
            return(File(codeImgBuffer, "image/jpeg"));
        }
Пример #14
0
        public ActionResult ShowVcode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string Codestr = validateCode.CreateValidateCode(4);

            Session["VCode"] = Codestr;
            byte[] img = validateCode.CreateValidateGraphic(Codestr);
            return(File(img, @"image/jpeg"));
        }
Пример #15
0
        /// <summary>
        /// 验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult VerificationCode()
        {
            ValidateCode validateCode = new Common.ValidateCode();
            string       code         = validateCode.CreateValidateCode(4);//生成验证码.

            Session["ValidateCode"] = code;
            byte[] buffer = validateCode.CreateValidateGraphic(code);
            return(File(buffer, "image/jpeg"));
        }
Пример #16
0
        public ActionResult ShowVCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();

            string strcode = validateCode.CreateValidateCode(5);

            Session["validate"] = strcode;
            byte[] imagebyte = validateCode.CreateValidateGraphic(strcode);
            return(File(imagebyte, @"image/jepg"));
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/jpeg";
            //生成验证码
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            validateCode.CreateValidateGraphic(code, context);
            context.Session["ValidateCode"] = code;
        }
Пример #18
0
        /// <summary>
        /// 显示验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowValidateCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);//产生验证码

            Session["validateCode"] = code;
            var buff = validateCode.CreateValidateGraphic(code);//将验证码画在画布上

            return(File(buff, "image/jpeg"));
        }
Пример #19
0
        public ActionResult ShowValidateCode()
        {
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);         //4位数验证码

            Session["validateCode"] = code;                           //将验证码存在Session中
            byte[] buffer = validateCode.CreateValidateGraphic(code); //将验证码绘制再画布中
            return(File(buffer, "image/jpeg"));

            #endregion
        }
Пример #20
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            Common.ValidateCode vc = new Common.ValidateCode();
            string code            = vc.CreateValidateCode(4);

            vc.CreateValidateGraphic(code, context);
            HttpContext.Current.Session.Add("ValidateCode", code);
            Console.WriteLine(code);
        }
Пример #21
0
        private string InitCaptcha()
        {
            string code = vc.CreateValidateCode(4);

            //session
            //Session["Captcha"] = code;
            //-------
            //memcache session
            //ms.SetValue<string>(code, "Captcha");
            //----------------
            //redis session
            rs.SetItem <string>("Captcha", code, SessionId);

            string imageUrl = Url.Content("~/UserLogin/CreateCaptchaImg?t=" + DateTime.Now.Ticks);

            return(String.Format("<img id=\"captchaImg\" src=\"{0}\" />", imageUrl));
        }
Пример #22
0
        public ActionResult validateCodeGet()
        {
            if (!checkRequestHeader(Request))
            {
                return(Content("forbid!"));
            }
            Common.ValidateCode validateCode = new Common.ValidateCode();
            string code = validateCode.CreateValidateCode(4);

            Session["validateCode"] = code;
            byte[] buffer = validateCode.CreateValidateGraphic(code);
            string str    = "data:image/png;base64," + Convert.ToBase64String(buffer);

            return(Json(new
            {
                base64Image = str
            }));
        }
Пример #23
0
        ////在一般处理程序中如果要使用Session必须实现
        //.IRequiresSessionState接口.
        //为什么要实现这个接口 实现了这个接口微软 肯定会给你做很多事情
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";


            Common.ValidateCode validateCode = new Common.ValidateCode();

            //验证码有两个内容 一个是验证码的字符 一个验证码的 图片
            //每一次请求的时候 这个sessionID的 的用户 key value的值 就会修改
            //相对安全。。但是 企业基本的有其他更加 安全的设置
            //了解其中的原理就可以 知道如何来使用
            string code = validateCode.CreateValidateCode(4);

            //什么时候存储数据 什么时候获取数据
            //如何区分不同的用户  自动会判断 这个用户SessionID下的数据
            //设置session的值。同时会把sessionid 通过cookie asp.net自动设置好
            //将sessionid 设置到用户的cookie中
            //如果cookie被禁用了 那就要提示了。
            context.Session["validateCode"] = code;
            validateCode.CreateValidateGraphic(code, context);

            //ASP.NET_SessionId=0hda1xnqk3geoavdhrv0yqcq
        }
Пример #24
0
 public ActionResult ShowValidateCode()
 {
     Common.ValidateCode validateCode = new Common.ValidateCode();
     string code = validateCode.CreateValidateCode(4);
     Session["validateCode"] = code;
     byte[] buffer = validateCode.CreateValidateGraphic(code);
     return File(buffer, "image/jpeg");
 }