1 /// <summary>
 2         /// 改变验证码
 3         /// 编写人:
 4         /// 编写日期:2017-02-28
 5         /// </summary>
 6         /// <param name="sender"></param>
 7         /// <param name="e"></param>
 8         protected void btnChangeImg_Click(object sender, EventArgs e)
 9         {
10             CreatImg();
11         }
12         /// <summary>
13         /// 取随机生成的图片
14         /// 编写人:
15         /// 编写日期:2017-02-28
16         /// </summary>
17         private void CreatImg()
18         {
19             string strRnd = CreateRnd(5);
20             ViewState["rnd"] = strRnd;
21             TD_YZM.InnerHtml = "<img src=\"Pages/ReadTempImg.aspx?Uid=" + Epoint.Frame.Bizlogic.common.Encrypt(strRnd, "EpointPW") + "\">";//登陆           
22         }
23         public string CreateRnd(int Leng)
24         {//产生随机数除Ii0O
25             string Ar1 = "A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,2,3,4,5,6,7,8,9";
26             //登录页面验证是否简单验证,即验证码为数字组成,否则由数字+字母组成。如果简单=1,否则=0
27             string LoginSimpleVlidate = ApplicationOperate.GetConfigValueByName("LoginSimpleVlidate");
28             if (LoginSimpleVlidate == "1")
29                 Ar1 = "0,1,2,3,4,5,6,7,8,9";
30 
31             string[] ListAr = Ar1.Split(',');
32             Random RD = new Random();
33             int rnd = 0;
34             string strRnd = "";
35             for (int j = 1; j < Leng; j++)
36             {
37                 rnd = RD.Next(0, ListAr.Length);
38                 strRnd += ListAr[rnd];
39             }
40             return strRnd;
41         }