Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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)
{


Ïà¹ØÎĵµ£º

asp.net´°ÌåµÄ´ò¿ªºÍ¹Ø±Õ

asp.net´°ÌåµÄ´ò¿ªºÍ¹Ø±Õ
//´ò¿ªÐµĴ°Ìå
Response.Redirect("WebMain.aspx");   
//µ¯³öÒ»¸öд°Ìå
Response.Write("<script>window.open(\"WebMain.aspx\")</script>")
//µ¯³öÒ»¸öÖ»ÓÐÈ·¶¨°´Å¥µÄÌáʾ¿ò
Response.Write("<script>alert(\"Óû§Ãû»òÃÜÂë´íÎó\");</script>") ......

ASP.NET ·þÎñÆ÷¿Ø¼þäÖȾµ½¿Í»§¶ËÖ®ºó¶ÔÓ¦µÄHTML±êÇ©

·þÎñÆ÷¿Ø¼þ        html±ê¼Ç
label----------<span/>
button---------<input type="submit"/>
textbox--------<input type="text"/>
linkbutton-----<a href="javascript:" />
imagebutton----<input type="image"/>
hyperlink------<a />
......

ASp.NETѧϰÍø(www.17aspx.com)ÉÏÏßÁË

¾­¹ýÒ»¸ö¶àÔµÄ×¼±¸£¬ÎÒµÄСվASP.NETѧϰÍø(www.17aspx.com)ÖÕÓÚÉÏÏßÁË¡£½çÃæͼÈçÏ£º
ASP.NETѧϰÍø(www.17aspx.com)£¬ÎªASP.NETѧϰÕßÌṩ½Ì³Ì¡¢Ê¾Àý¡¢Ô´Âë¡¢¹¤¾ßµÈѧϰ×ÊÁÏ£¬Íƶ¯ASP.NETѧϰÕßÖ®¼äµÄ½»Á÷¡£Éæ¼°ASP.NET¡¢ASP.NET MVC¡¢LINQ¡¢VS2010¡¢WPF¡¢Silverlight¡¢C#3.5µÈ·½Ãæ¡£ ......

ASP.Net¿ªÔ´ÏîÄ¿¼¯½õ£¨Ç¿£©

¾­¹ý΢Èí.net Framework 2.0µÄ¸ïУ¬.netƽ̨µÄ¿ª·¢Ô½À´Ô½¾«²Ê¡£±ÊÕßÊÕ¼¯»ùÓÚ.net¿ª·¢µÄn¸öÏîÄ¿£¬Ò»·½ÃæΪÐÂÊÖÌṩÓмÛֵѧϰ×ÊÔ´£¬ÅàÑøÆðÈí¼þ¿ª·¢µÄÀÖȤ£¬ÁíÒ»·½Ãæ¹²ÃãÒÑ´ÓÊÂ.netÁìÓò¹¤×÷¶àÄê²¢ÓÐÃ÷È··¢Õ¹Ä¿±êµÄͬÈÊ£¬Ìá¸ß×Ô¼º£¬¸üÉÏÒ»²ãÂ¥¡£
SharpDevelop
Ç¿´óµÄ²å¼þϵͳ£¬Í¨¹ýAddin¹¹½¨³ÉÒ»¸ö¹¦ÄÜÆëÈ«µÄ.net¿ª·¢IDE¡£º ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ