Can color CAPTCHA images defend against attacks by others?
When someone else uses the polling technology to simulate login, he does not know what your verification code is, nor can he obtain it, because this is an image, the computer cannot identify the number in it (unless the interference in the verification code is cracked, the verification code may be read using the relevant image recognition technology. This will not be used here ). If you cannot read the verification code, you will not be able to perform round-robin. Of course, we must first determine whether the verification code is correct in the background to avoid occupying server resources.
3. Random Number code
① Random Number
1 /// <summary>
2 // Random Number
3 /// </summary>
4 /// <returns> </returns>
5 private string getrndnum ()
6 {
7 string code = string. empty;
8 random = new random ();
9 for (int I = 0; I <4; I ++)
10 {
11 code = code + random. next (9). tostring ();
12}
13 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;
10 random rand = new random ();
11 for (int I = 0; I <4; I ++)
12 {
13 rand = new random (unchecked (int) datetime. now. ticks); // to obtain different random sequences
14 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 starts from 0
15 checkcode + = vcarray [t];
16}
17 return checkcode;
18}
1 2 3