All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
你可能已经知道或者不知道的ASP.NET,2.0技巧_[Asp.Net教程]
修复SQL Server的MDF文件_[SQL Server教程]
ASP.NET Remoting体系结构(五)
如何让你的SQL运行得更快(2)_[SQL,Server教程]
为ASP.NET,MVC开发一些常用插件(一)——导航栏_[Asp.Net教程]
随机显示图片的javascript网页特效源代码_JavaScript技术_编程技术
用PHP程序实现删除目录的三种方法实例_php资料_编程技术
C#编程技巧:轻松实现对文件的操作_[Asp.Net教程]
C#动态生成树型结构的Web程序设计实例_.net资料_编程技术
让PHP支持页面回退的两种方法_php资料_编程技术
Reading number is top 10 pictures
最2B的公司制度
贩卖儿童者必须判死刑
The little girl with long hair3
做运动的校花2
Sora aoi possession of boudoir1
Born After 90 Beijing sports university campus flower photos3
Exquisite decoration is not paying too much3
The Soviet union swimsuit exposure in the 70 year3
The girl of like self-time
Small QiShu -- ShuangShuangPan2
Download software ranking
Boxer vs Yellow4
Unix video tutorial13
艳兽都市
软件工程思想
Tram sex maniac 2 (H) rar bag3
Boxer's Top ten classic battle4
Tram sex maniac 2 (H) rar bag15
终极变速大师Speeder3.26
Unix video tutorial15
linux初级教程
归海一刀 published in(发表于) 2014/1/30 1:20:57 Edit(编辑)
ASP.NET实现数字、字符混合验证码_[Asp.Net教程]

ASP.NET实现数字、字符混合验证码_[Asp.Net教程]

ASP.NET实现数字、字符混合验证码_[Asp.Net教程]

















首先,我要简要说说Session和ViewState的用法,因为后面会用到它
把数据存储在Session中:Session("key")="test"
从Session取值:dim testvalue as string=Session("key")
类似的:
把数据存储在ViewState中:ViewState("key")="test"
从ViewState中取值:dim testvalue as string=ViewState("key")
关于ViewState的更详细的资料,你可以参看MSDN的<>一文
百闻不如一见,有时代码本身就比任何解说更有表现力,所以在此就不对代码解说太多了,本文实现的验证码需要用到两个文件:
gif.aspx 该文件用于生成验证码
ValidateCode.aspx 该文件用来测试验证码(即如何使用)
下面给出gif.aspx的完整代码:
<%@ import namespace="System"%>
<%@ import namespace="System.io"%>
<%@ import namespace="System.Drawing"%>
<%@ import namespace="System.Drawing.Imaging"%>

那么又应该如何使用该文件生成的图象验证码,看这句代码:

这就是用来显示验证码的Image控件,你可以把它放在任何你喜欢的地方,下面的给出详细的使用代码,你把它保存为ValidateCode.aspx,并把它和gif.aspx放在同一目录下,在浏览器中打开ValidateCode.aspx,就可以测试它的效果了:


















&nbsp;




&nbsp;




&nbsp;




&nbsp;




&nbsp;




&nbsp;




&nbsp;

























&nbsp;




&nbsp;



















































&nbsp;




验证码:









&nbsp;




&nbsp;




&nbsp;










&nbsp;




输入验证码:









*注意:区分大小写




&nbsp;










&nbsp;




&nbsp;




&nbsp;




&nbsp;




&nbsp;




&nbsp;




&nbsp;










&nbsp;




&nbsp;




&nbsp;









&nbsp;




&nbsp;




&nbsp;















































添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.