public static byte[] CreateCodeImg() { string code; byte[] img = new CaptchaStyle2().CreateImage(out code); System.Web.HttpContext.Current.Session["Captcha"] = code; return(img); }
/// <summary> /// 生成登录验证码 /// </summary> public static void CreateCode() { string code; byte[] img = new CaptchaStyle2().CreateImage(out code); System.Web.HttpContext.Current.Session["Captcha"] = code; System.Web.HttpContext.Current.Response.ClearContent(); System.Web.HttpContext.Current.Response.ContentType = "image/Gif"; System.Web.HttpContext.Current.Response.BinaryWrite(img); System.Web.HttpContext.Current.Response.End(); }