ASP image verification is not used Components

Font you want to do with ASP image verification


Ha ~ ~ long time did not send the article a
donkey - long ago changed jobs recently also good, relatively empty -
not long-winded, speaking at today's topic -

Because of their work, recently needed to use ASP, ASP.NET pictures verification (and can not use the component)
ASP.NET System.Drawing itself can be used directly to turn into a font drawing, draw miscellaneous point, using a gradient .. . etc. is not a problem
but the blanket ~ ~ ASP .... can be difficult to find examples of most of the network, to the bottom of this it ~

ASP图片验证
01 <%
02 Call Com_CreatValidCode()  
03
04 Sub Com_CreatValidCode()
05     Response.Expires = -9999  
06     Response.AddHeader "Pragma","no-cache"  
07     Response.AddHeader "cache-ctrol","no-cache"  
08     Response.ContentType = "Image/BMP"  
09     Randomize  
10     Dim i, ii, iii  
11     Const cAmount = 36
12     Const cCode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"  
13     Dim vColorData(2)  
14     a=CInt(Int(Rnd * 256))
15     b=CInt(Int(Rnd * 256))
16     c=CInt(Int(Rnd * 256))
17     vColorData(0) = ChrB(a) & ChrB(b) & ChrB(c) '随机产生颜色
18 vColorData (1) = ChrB ( 255) & ChrB (255) & ChrB (255) ' white
. 19 Dim VCODE (. 4), vCodes  
20 is the For I = 0 the To. 3  
21 is VCODE (I) = Int (the Rnd * cAmount)' randomly generated 35 ~ 0
22 is vCodes = vCodes & Mid (CCODE, VCODE (I) +. 1,. 1) 'and obtain the corresponding character series
23 is the Next
24 the session ( "checkcode") = vCodes' vCodes both generated string of
25 Dim vNumberData (36) 'vNumberData ( 0) 0 corresponding to the character image' vNumberData (10) corresponding to the character image 10 is
26 is vNumberData (0) = "1110000111110111101111011110111101001011110100101111010010111101001011110111101111011110111110000111"  
27 vNumberData (. 1) = "1111011111110001111111110111111111011111111101111111110111111111011111111101111111110111111100000111"  
28     vNumberData(2)  = "1110000111110111101111011110111111111011111111011111111011111111011111111011111111011110111100000011"
29     vNumberData(3)  = "1110000111110111101111011110111111110111111100111111111101111111111011110111101111011110111110000111"
30     vNumberData(4)  = "1111101111111110111111110011111110101111110110111111011011111100000011111110111111111011111111000011"
31     vNumberData(5)  = "1100000011110111111111011111111101000111110011101111111110111111111011110111101111011110111110000111"  
32     vNumberData(6)  = "1111000111111011101111011111111101111111110100011111001110111101111011110111101111011110111110000111"  
33     vNumberData(7)  = "1100000011110111011111011101111111101111111110111111110111111111011111111101111111110111111111011111"  
34     vNumberData(8)  = "1110000111110111101111011110111101111011111000011111101101111101111011110111101111011110111110000111"  
35     vNumberData(9)  = "1110001111110111011111011110111101111011110111001111100010111111111011111111101111011101111110001111"  
36     vNumberData(10) = "1111011111111101111111101011111110101111111010111111101011111100000111110111011111011101111000100011"  
37     vNumberData(11) = "1000000111110111101111011110111101110111110000111111011101111101111011110111101111011110111000000111"  
38     vNumberData(12) = "1110000011110111101110111110111011111111101111111110111111111011111111101111101111011101111110001111"  
39     vNumberData(13) = "1000001111110111011111011110111101111011110111101111011110111101111011110111101111011101111000001111"  
40     vNumberData(14) = "1000000111110111101111011011111101101111110000111111011011111101101111110111111111011110111000000111"  
41     vNumberData(15) = "1000000111110111101111011011111101101111110000111111011011111101101111110111111111011111111000111111"  
42     vNumberData(16) = "1110000111110111011110111101111011111111101111111110111111111011100011101111011111011101111110001111"  
43     vNumberData(17) = "1000100011110111011111011101111101110111110000011111011101111101110111110111011111011101111000100011"  
44     vNumberData(18) = "1100000111111101111111110111111111011111111101111111110111111111011111111101111111110111111100000111"  
45     vNumberData(19) = "1110000011111110111111111011111111101111111110111111111011111111101111111110111110111011111000011111"  
46     vNumberData(20) = "1000100011110111011111011011111101011111110001111111010111111101101111110110111111011101111000100011"  
47     vNumberData(21) = "1000111111110111111111011111111101111111110111111111011111111101111111110111111111011110111000000011"  
48     vNumberData(22) = "1000100011110010011111001001111100100111110101011111010101111101010111110101011111010101111001010011"  
49     vNumberData(23) = "1000100011110011011111001101111101010111110101011111010101111101100111110110011111011001111000110111"  
50     vNumberData(24) = "1110001111110111011110111110111011111011101111101110111110111011111011101111101111011101111110001111"  
51     vNumberData(25) = "1000000111110111101111011110111101111011110000011111011111111101111111110111111111011111111000111111"  
52     vNumberData(26) = "1110001111110111011110111110111011111011101111101110111110111011111011101001101111011001111110001011"  
53     vNumberData(27) = "1000001111110111011111011101111101110111110000111111010111111101101111110110111111011101111000110011"  
54     vNumberData(28) = "1110000011110111101111011110111101111111111001111111111001111111111011110111101111011110111100000111"  
55     vNumberData(29) = "1000000011101101101111110111111111011111111101111111110111111111011111111101111111110111111110001111"  
56     vNumberData(30) = "1000100011110111011111011101111101110111110111011111011101111101110111110111011111011101111110001111"  
57     vNumberData(31) = "1000100011110111011111011101111101110111111010111111101011111110101111111010111111110111111111011111"  
VNumberData 58 (32) = "1001010011110101011111010101111101010111110101011111001001111110101111111010111111101011111110101111"  
59 vNumberData (33 is) = "1000100011110111011111101011111110101111111101111111110111111110101111111010111111011101111000100011"  
60 vNumberData (34 is) = "1000100011110111011111011101111110101111111010111111110111111111011111111101111111110111111110001111"  
61 is vNumberData (35) = "1100000011110111011111111101111111101111111110111111110111111111011111111011111111101110111100000011"
62 is' produced under the drawing program
63     Response.BinaryWrite ChrB(66) & ChrB(77) & ChrB(230) & ChrB(4) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(54) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(40) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(40) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(10) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(1) & ChrB(0)
64     Response.BinaryWrite ChrB(24) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(176) & ChrB(4) & ChrB(0) & ChrB(0) & ChrB(18) & ChrB(11) & ChrB(0) & ChrB(0) & ChrB(18) & ChrB(11) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) &The ChrB (0)   68 'the If the Rnd * 99 +. 1 <the Then. 3' <larger value representative of the right generated Figure see of the original word is not clear   67 III the For the To = 10. 1   66 = 0 the For the To. 3 II    
65 = I. 9 the For the To the Step -1 0  



69     '    Response.BinaryWrite vColorData(0) '使用随机产生的颜色
70     'Else  
71     '    Response.BinaryWrite vColorData(Mid(vNumberData(vCode(ii)), i * 10 + iii, 1))  
72     'End If  
73     '0 <= vCode(X) <= 35; 91~100 .. 81~90 ...... 1~10;
74     Response.BinaryWrite vColorData(Mid(vNumberData(vCode(ii)), i * 10 + iii, 1))  
75       Next  
76   Next  
77     Next  
78 End Sub    
79 %>

Fixed font size is fixed .... .... .... can only be set miscellaneous points
that - because the system did not have a choice, that is, ASP, but to add this functionality -
Well, then ... to get a donkey , to borrow vb.net to generate font string (vNumberData), into the picture inside the array
and then modify the ASP program - now .... there gradient, foreground Noise, miscellaneous line background, font edges soften, you can choose they want ..... even use the font in the text -
this is a graphic produced  ha ~


this ~ it is used to generate vNumberData program screen -


the program of the last donkey attach produce vNumberData, asp pages on the web page there are instructions to modify the ~
interested greatly enjoy your meal ~

ASP image verification .rar

Original: Big Box  ASP image verification is not used Components


Guess you like

Origin www.cnblogs.com/petewell/p/11465537.html