各种语言的验证码代码[asp]

作者: unvs 分类: ASP.NET 发布时间: 2011-03-11 23:22 ė15,243 views 61条评论

两个最简单的ASP验证码代码(ASP)

1、<%
Public Function BornVerifyCode()
       Randomize 设置随机因子
       BornVerifyCode=Mid((Rnd * 1000000), 1, 4) 生成6位随机数,取高4位
    End Function
%>

调用:<%=BornVerifyCode%>

2、<%
Function CheckCode
     const theNum = 4            设置位数,修改就是了
*************************************************************
     dim strCode,theCodes,str0
     theCodes = ""  初始化验证码字符
          strCode = "123456789AABCDEFGHI135GGW468HJKLMNTPQRS148963TUVWR"
          strCode = LCASE(strCode)  全部换成小写,当然也可不换
     RANDOMIZE
         for i = 1 to theNum  
              循环结构重复筛选单个字符进行组合,生成theNum位的验证码
         str0=mid(strCode,INT((50-1+1)*RND+1),1)  
              str0为一次循环周期内经筛选的单个临时字符
         theCodes = theCodes&str0  字符叠加过程
         next
     if theCodes = "" then 
              theCodes = "9999"  
          end if        
     Session("SystemRocCode") = cstr(theCodes) 
          将字符结果保存在Seesion中
     Response.Write theCodes  显示出验证字符
End Function
%>

调用:<%=CheckCode%>

相关文章:asp.net生成验证码代码

                    JS生成验证码代码

本博文章基本上属于原创或收集整理,都是心血结晶。
欢迎转载分享,转载请注明出处,谢谢!
本文地址:各种语言的验证码代码[asp]

一条评论

  1. 山山来迟 2012 年 5 月 13 日 上午 10:25 回复

    验证码搞了很多款,最专业的是皕应的HCaptcha http://www.hinsite.com

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Ɣ回顶部