Aspx页面设计源代码
Aspx页面设计源代码
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >
Aspx后台设计源代码
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = Request.Cookies("name").Value.ToString() '从cookies中接收随机字符串
s = s.ToLower() '转换为小写自符
If TextBox1.Text.ToLower = s Then
MsgBox("succeed")
Else : MsgBox("failed")
End If '判断是否正确
End Sub
End Class
随即图形生成源代码
Partial Class Default2
Inherits System.Web.UI.Page
Public s As String = "" '随即验证码字符形式
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Clear() '清除返回缓存流
'随机数产生过程()
Dim number1 As Integer 'for语句将用到的变量
Dim number2 As Integer
number2 = 4 '要生成几个字符的验证码便赋值几
Dim random As New Random '新建随机生成器
Dim number3 As Integer '‘用于保存随机产生的数值
For number1 = 1 To number2
number3 = random.Next(62) '定义随机数上界
Select Case number3
Case 0
s = s + "0"
Case 1
s = s + "1"
Case 2
s = s + "2"
Case 3
s = s + "3"
Case 4
s = s + "4"
Case 5
s = s + "5"
Case 6
s = s + "6"
Case 7
s = s + "7"
Case 8
s = s + "8"
Case 9
s = s + "9"
Case 10
s = s + "A"
Case 11
s = s + "B"
Case 12
s = s + "C"
Case 13
s = s + "D"
Case 14
s = s + "E"
Case 15
s = s + "F"
Case 16
s = s + "G"
Case 17
s = s + "H"
Case 18
s = s + "I"
Case 19
s = s + "G"
Case 20
s = s + "K"
Case 21
s = s + "L"
Case 22
s = s + "M"
Case 23
s = s + "N"
Case 24
s = s + "O"
Case 25
s = s + "P"
Case 26
s = s + "Q"
Case 27
s = s + "R"
Case 28
s = s + "S"
Case 29
s = s + "T"
Case 30
s = s + "U"
Case 31
s = s + "V"
Case 32
s = s + "W"
Case 33
s = s + "X"
Case 34
s = s + "Y"
Case 35
s = s + "Z"
Case 36
s = s + "a"
Case 37
s = s + "b"
Case 38
s = s + "c"
Case 39
s = s + "d"
Case 40
s = s + "e"
Case 41
s = s + "f"
Case 42
s = s + "g"
Case 43
s = s + "h"
Case 44
s = s + "i"
Case 45
s = s + "g"
Case 46
s = s + "k"
Case 47
s = s + "l"
Case 48
s = s + "m"
Case 49
s = s + "n"
Case 50
s = s + "o"
Case 51
s = s + "p"
Case 52
s = s + "q"
Case 53
s = s + "r"
Case 54
s = s + "s"
Case 55
非常好我支持^.^
(0) 0%
不好我反对
(0) 0%