c# 数字和英文字母的 验证码

来源:百度知道 编辑:UC知道 时间:2024/09/23 08:56:06
c# 注册页面中的验证码 需要 数字和英文字混合的
希望写上注释
非常感谢!!

protected void Page_Load(object sender, EventArgs e)
{
VerifyCode v = new VerifyCode();
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, this.Context); // 输出图片
Response.Cookies.Add(new HttpCookie("vCode", code)); // 使用Cookies取验证码的值
}

//验证码长度(默认6个验证码的长度)
int length = 4;
public int Length
{
get { return length; }
set { length = value; }
}

//验证码字体大小(为了显示扭曲效果,默认20像素,可以自行修改)
int fontSize = 12;
public int FontS