asp.net¼òµ¥Êý×ÖÑéÖ¤ÂëµÄʵÏÖ
µ÷ÓÃ
ÑéÖ¤Â룺<input type="text" id="txtValidate" style="border: solid 1px #9B9B9B; width: 85px;
height: 17px;" /> <img src="Rnd.aspx" mce_src="Rnd.aspx" style="width: 58px; height: 17px;
border: solid 1px #9B9B9B" align="absmiddle" />
ºǫ́ʵÏÖ
Rnd.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Drawing;
using System.Drawing.Imaging;
public partial class Rnd : System.Web.UI.Page
{
private int codeLen = 5;//Ëæ»úÏÔʾ×Ö·û¸öÊý
private int fineness = 100;//ͼƬÇåÎú¶È
private int imgWidth = 65;//ͼƬ¿í¶È
private int imgHeight = 20;//ͼƬ¸ß¶È
private string fontFamily = "Roman";//×ÖÌåÃû³Æ
private int fontSize = 12; //×ÖÌå´óС
private Random random = new Random();
protected void Page_Load(object sender, EventArgs e)
{
string validateCode = CreateValidateCode();
Session["RandomNumber"] = validateCode;
Bitmap bitmap = new Bitmap(imgWidth, imgHeight);
DisturbBitmap(bitmap);
DrawValidateCode(bitmap, validateCode);
bitmap.Save(Response.OutputStream, ImageFormat.Gif);
}
private string CreateValidateCode()//µÃµ½Ëæ»úÊý
{
string validateCode = "";
for (int i = 0; i < codeLen; i++)
{
int n = random.Next(10);//·µ»ØÒ»¸öСÓÚ×î´óÖµµÃËæ»úÊý
validateCode += n.ToString();
}
return validateCode;
}
private void DisturbBitmap(Bitmap bitmap)//»ñÈ¡±³¾°Í¼
{
for (int i = 0; i < bitmap.Width; i++)
{
for (int j = 0; j < bitmap.Height; j++)
{
if (random.Next(90) <= this.fineness)
{
Ïà¹ØÎĵµ£º
ǰ̨Éè¼ÆÒ³Ãæ.aspx
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
</div>
  ......
×î½üÔÚ¶ÔÓ¦Ò»¸öASP.NET WebÓ¦ÓóÌÐòBugµÄʱºò£¬ÎªÁ˵÷²éÔËÐл·¾³ÖоßÌåµÄBugÓÚÊDzéÔÄÁËһϴíÎóÈÕÖ¾¡£
Õâ¸ö³ÌÐòµÄ´íÎóÈÕÖ¾ÊÇÖ±½Ó±£´æÔÚÒ»¸öÎı¾ÎļþÖе쬽á¹û·¢ÏÖ¾ÍËãÊdzö´íÒ²²»»áÁôÏÂÈκκۼ£¡£
Ò»µ÷ÊÔ£¬¾¹È»ÊǰѴíÎóÈÕÖ¾µÄ±£´æÂ·¾¶¸øÐ´´íÁË¡£My God£¡
°Ñ·¾¶¸ÄÁË£¬×ªÄîÒ»ÏëÏ´γö´íÔÙ²»±£´æÔõô°ì£¿ËÖªµÀÕæÕýµÄ»·¾³À ......
protected void Button6_Click(object sender, EventArgs e)
{
this.Label11.Text = HtmlEncode(this.TextBox3.Text);
}
protected static string HtmlEn ......
public static bool AddTbmember(Tbmember member, string regip)
{
bool check = false;
try
{
SqlCommand sqlcommnad = new SqlCommand("Pro_AddUsers", sqlconn.GetConn());
sqlcommnad.CommandType = CommandType.StoredProcedure; ......
Default..aspx
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
Default..aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.We ......