public ImageResult(string code,VerifyCode v) { Code = code; verifyCode = v; }
public ImageResult VerifyCodeAction() { VerifyCode v = new VerifyCode(); v.Length = 4; v.FontSize = 20; v.Chaos = true; v.BackgroundColor = Color.White; v.ChaosColor = Color.LightGray; v.CodeSerial = "2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,k,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,K,M,N,P,Q,R,S,T,U,V,W,X,Y,Z"; v.Colors = new Color[] {Color.Black,Color.Red,Color.DarkBlue,Color.Green,Color.Orange,Color.Brown,Color.DarkCyan,Color.Purple}; v.Fonts = new string[] {"Arial", "Georgia"}; v.Padding = 2; string code = v.CreateVerifyCode(); //取随机码 ImageResult res = new ImageResult(code,v); Session["CheckCode"] = code.ToUpper();// 使用Session取验证码的值 return res; }