//ASP. NET user login interface often uses the CAPTCHA code as followsPrivate voidPage_Load (Objectsender, System.EventArgs e) {//Place user code here to initialize the pageLabel4.text=randomnum (4);} Public stringRandomnum (intN//{stringStrchar ="0,1,2,3,4,5,6,7,8,9" ;string[] Vcarray = Strchar. Split (',') ;stringVnum ="" ;//because the string is short, you don't have to StringBuilder.inttemp =-1 ; //record the last random value and try to avoid generating several random numbers//A simple algorithm is used to ensure that the random numbers are generated differently.Random Rand =NewRandom (); for(inti =1; I < n+1; i++ ) { if(Temp! =-1) {Rand=NewRandom (i*temp*unchecked((int) (DateTime.Now.Ticks)) ;} //int t = rand. Next (+);intT=rand. Next (Ten);if(Temp! =-1&& temp = =t) {returnrndnum (n);} Temp=T; Vnum+=vcarray[t];}returnVnum;//returns the generated random number}//' function name: Rndnum//' function parameter: vcodenum--sets the number of digits that return a random string//' function function: a random string that produces a mix of numbers and charactersPrivate stringRndnum (intvcodenum) { stringVchar ="0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,x,y,z" ; string[] Vcarray = Vchar.split (",". ToCharArray ());//to generate an array of stringsstringVnum =""; inti; for(i=1; i<vcodenum;i++) {system.random ro=NewRandom ();DoubleDecA =ro. Nextdouble (); Vnum= Vnum + Vcarray[convert.toint32 ( **DecA)]; } //For I=1 to Vcodenum//Randomize//Vnum=vnum & Vcarray (Int (35*rnd)) ' array is generally read from 0, so this is 35*rnd//NextreturnVnum;}//ASP. NET Login Interface user CAPTCHA code, network collection and collation test
Asp. NET Login Interface User verification code