コード例 #1
0
ファイル: SystemC.cs プロジェクト: coodream/cms
 /// <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;
     }
 }
コード例 #2
0
ファイル: RequestHandle.cs プロジェクト: ReinhardHsu/devfw
 /// <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);
 }