Color Verification Code pictures can defend against other people's attack?
Because when someone uses a polling technique to simulate a login, he doesn't know what your verification code is, can not get, because this is a picture, the computer does not recognize what the number is inside (unless you crack the verification code inside the interference, and then use the relevant image recognition technology may read out the verification code, here is not to pull this). Can not read the verification code will not have the opportunity to poll access, of course, we judge the background must first determine whether the verification code is correct to prevent the use of server resources.
3. Random number Code
① Digital Random number
1///<summary>
2///Digital Random number
3///</summary>
4///<returns></returns>
5 private string Getrndnum ()
6 {
7 String code = String.Empty;
8 random random = new random ();
9 for (int i = 0; i < 4; i++)
10 {
One code = code + RANDOM.NEXT (9). ToString ();
12}
return code;
14}
② string Random number
1///<summary>
2///String Verification code
3///</summary>
4///<returns></returns>
5 private string Getrndstr ()
6 {
7 String Vchar = "A,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
8 string[] Vcarray = Vchar.split (', ');
9 string checkcode = String.Empty;
Random rand = new Random ();
for (int i = 0; i < 4; i++)
12 {
Rand = new Random (unchecked (int) datetime.now.ticks);//To get a different random sequence
int t = rand.next (vcarray.length);/the exclusive upper bound of the random number to be generated. MaxValue must be greater than or equal to zero, subscript starting from 0
Checkcode + = vcarray[t];
16}
return checkcode;
18}