Exemple #1
0
        /// <summary>
        /// 登录验证码
        /// </summary>
        public void VerifyCode_GET()
        {
            string     word = null;
            VerifyCode v    = new VerifyCode();
            var        font = v.GetDefaultFont();

            try
            {
                font          = new System.Drawing.Font(font.FontFamily, 16);
                v.AllowRepeat = false;
                Response.BinaryWrite(v.GraphicDrawImage(4,
                                                        VerifyWordOptions.Letter,
                                                        !true,
                                                        font,
                                                        60,
                                                        out word));
                VerifyCodeManager.AddWord(word);
                Response.ContentType = "Image/Jpeg";
            }
            catch (Exception exc)
            {
                if (font != null)
                {
                    font.Dispose();
                }
                throw exc;
            }
        }
        /// <summary>
        /// 验证码
        /// </summary>
        /// <param name="context"></param>
        public void VerifyCode(HttpContext context)
        {
            string     word = null;
            VerifyCode v    = new VerifyCode();
            var        font = v.GetDefaultFont();

            try
            {
                font          = new System.Drawing.Font(font.FontFamily, 16);
                v.AllowRepeat = false;
                context.Response.BinaryWrite(v.GraphicDrawImage(4,
                                                                VerifyWordOptions.Number,
                                                                !true,
                                                                font,
                                                                30,
                                                                out word));
            }
            catch
            {
                if (font != null)
                {
                    font.Dispose();
                }
            }
            context.Response.ContentType = "Image/Jpeg";
            VerifyCodeManager.AddWord(word);
        }
Exemple #3
0
 /// <summary>
 ///     验证码
 /// </summary>
 /// <param name="context"></param>
 public void VerifyCode(HttpContext context)
 {
     string word = null;
     var v = new VerifyCode();
     var font = v.GetDefaultFont();
     try
     {
         font = new Font(font.FontFamily, 16);
         v.AllowRepeat = false;
         context.Response.BinaryWrite(v.GraphicDrawImage(4,
             VerifyWordOptions.Number,
             !true,
             font,
             30,
             out word));
     }
     catch
     {
         if (font != null)
         {
             font.Dispose();
         }
     }
     context.Response.ContentType = "Image/Jpeg";
     VerifyCodeManager.AddWord(word);
 }
Exemple #4
0
 /// <summary>
 /// 登录验证码
 /// </summary>
 public void VerifyCode_GET()
 {
     string word = null;
     VerifyCode v = new VerifyCode();
     var font = v.GetDefaultFont();
     try
     {
         font = new System.Drawing.Font(font.FontFamily, 16);
         v.AllowRepeat = false;
         Response.BinaryWrite(v.GraphicDrawImage(4,
             VerifyWordOptions.Letter,
             !true,
             font,
             60,
             out word));
     }
     catch
     {
         if (font != null)
         {
             font.Dispose();
         }
     }
     Response.ContentType = "Image/Jpeg";
     VerifyCodeManager.AddWord(word);
 }