虽然现在很多网站都在用lamp来搭建网站,但是别忘了还有win的一席之地,微软公司开发的东西自然不会差到哪里去,许多人就是冲着这名头义无所顾地投到了win的大旗下,所以知码网也不会忽略了这一部分的朋友,下面我们就来看一个win下的验证码页面程序。
验证码应用前台程序:
<body>
<form id="form1"runat="server">
<div>
<asp:TextBox ID="TextBox1"runat="server"></asp:TextBox>
<asp:Image ID="Image1"runat="server" ImageUrl="VerifyChar.aspx" /><br />
<br />
<asp:Button ID="Button1"runat="server" Text="提交" /></div>
</form>
</body>
验证码图片生成程序:
以下程序在VS2003和VS2005下通过。
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Partial Class VerifyChar
Inherits System.Web.UI.Page
Private Const PI As Double =3.14159265358979
Private Const PI2 As Double= 6.28318530717959
Private Sub Page_Load(ByValsender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache) ’不缓存
Dim x, y, x1, y1 As Single
Dim PenWidth1, PenWidth2,VerifyVharFont As Integer
Dim VerifyChar As String =R