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(); //使用Session存储验证码的值 Session["ImageVerifyCode"] = code; //输出图片 v.CreateImageOnPage(code, this.Context); }