CommWEB/VerifyImage.ashx.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
namespace CommLeiWeb
{
/// <summary>
/// 生成验证码
/// </summary>
public class VerifyImage : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
VerifyImage v = new VerifyImage();
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);//如不加,单击验证图片'看不清换一张'
v.Length = this.length;
v.FontSize = this.fontSize;
v.Chaos = this.chaos;
v.BackgroundColor = this.backgroundColor;
v.ChaosColor = this.chaosColor;
v.CodeSerial = this.codeSerial;
v.Colors = this.colors;
v.Fonts = this.fonts;
v.Padding = this.padding;
string code = v.CreateVerifyCode(); //取随机码
v.CreateImageOnPage(code, context); // 输出图片
context.Response.Cookies.Add(new HttpCookie("VerifyCode", code.ToUpper()));// 使用Cookies取验证码的值
}
public bool IsReusable
{
get
{
return false;
}
}
#region 验证码长度(默认6个验证码的长度)
int length = 4;
public int Length
{
get { return length; }
set { length = value; }
}
#endregion
#region 验证码字体大小(为了显示扭曲效果,默认40像素,可以自行修改)
后面还有 254 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
