| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 385 人关注过本帖
标题:验证码的问题
只看楼主 加入收藏
tracytheron
Rank: 2
等 级:论坛游民
帖 子:15
专家分:49
注 册:2010-8-6
结帖率:100%
收藏
 问题点数:0 回复次数:1 
验证码的问题
小弟初学,请问为什么验证会错误?
Default.asp.vb
Partial Class _Default
    Inherits System.Web.UI.Page

    Function RndNum(ByVal VcodeNum)
        Dim Vchar As String = "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"
        Dim VcArray() As String = Split(Vchar, ",")
        Dim VNum As String = ""
        Dim i As Byte
        For i = 1 To VcodeNum
            Randomize()
            VNum = VNum & VcArray(Int(35 * Rnd()))
        Next
        Return VNum
    End Function
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim VNUM As String
        Response.Cookies("VNUM").Value = RndNum(4)
        VNUM = Request.Cookies("VNUM").Value
        Label1.Text = VNUM

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = Label1.Text.ToLower Then
            Label3.Text = "用户您好,欢迎登陆我是范范饭"
        Else
            Label3.Text = "验证码错误啦!!!"
        End If
    End Sub
End Class

Default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<html xmlns="http://www. >
<head id="Head1" runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        验证码:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Label ID="Label1" runat="server" Width="176px"></asp:Label>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <br />
        <asp:Label ID="Label3" runat="server" ForeColor="Lime" Height="96px" Width="384px"></asp:Label>
        </div>
    </form>
</body>
</html>
搜索更多相关主题的帖子: 验证码 
2011-05-18 14:10
tracytheron
Rank: 2
等 级:论坛游民
帖 子:15
专家分:49
注 册:2010-8-6
收藏
得分:0 
已自行解决~

Learning
2011-05-18 15:15
快速回复:验证码的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.060187 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved