顯示驗證碼的界面
前台
<td class=
驗證碼
<td class=
<asp:TextBox ID=
<asp:Image ID=
<asp:HyperLink ID=
NavigateUrl=
</td>
後台
using System;
using System
using System
using System
using System
using System
using System
using System
using System
public partial class _Default : System
{
protected void Page_Load(object sender
{
}
protected void Button
{
string str = ConfigurationManager
using (SqlConnection sqlCnn=new SqlConnection(str))
{
using (SqlCommand sqlCmm=sqlCnn
{
sqlCmm
sqlCnn
SqlDataReader reader = sqlCmm
bool bl = false;
if (reader!=null)
{
while (reader
{
if (this
{
bl = true;
}
}
if (bl==true)
{
ClientScript
}
else
{
ClientScript
}
}
}
}
}
}
做驗證碼的界面
using System;
using System
using System
using System
using System
using System
using System
using System
using System
public partial class Default
{
protected void Page_Load(object sender
{
System
Graphics g = Graphics
this
g
string code = this
Font font = new Font(
Session[
g
this
MemoryStream ms = new MemoryStream();
img
this
this
this
}
private void DealImage(System
{
Bitmap b = img as Bitmap;
Random ran = new Random();
for (int i =
{
b
}
}
private string GenerateCode() //產生隨機數
{
Random ran = new Random(DateTime
StringBuilder sb = new StringBuilder(
for (int i =
{
sb
}
return sb
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12053.html