生成4位随机验证码

 //@ 2006 flyasm
Random newRandom=new Random();
txtRandom.Text="";
string tempRandom="";
for(int i=0;i<4;i++)
   {
    string t=Convert.ToInt16(9*a.NextDouble()).ToString();
    code.Text+="<img src='images/random/"+t+".gif'>";
    tempRandom+=t;
    txtRandom.Text=tempRandom;
   }
   Session.Add("code",tempRandom);

posted on 2006-02-18 15:49  flyasm  阅读(215)  评论(0)    收藏  举报