ASP.NET 2.0 ʵÏÖα¾²Ì¬ÍøÒ³·½·¨
¿´ÁËÄÇô¶à£¬»¹ÊÇÇ××Ô¶¯ÊÖʵ¼ùÏÂÓÐЧ¹û¡£
ÒýÓà °Ù¶È ÑîÔÆ·ÉaiÉú»î
ASP.NET 2.0 ʵÏÖα¾²Ì¬ÍøÒ³·½·¨
·½·¨Ò»£ºÀûÓÃHttphandlerʵÏÖURLÖØд£¨Î±URL¼°Î±¾²Ì¬£©
ÎÒÃÇÓÐʱºò»á¼ûµ½ÕâÑùµÄµØÖ·£º“http://www.huoho.com/show-12-34.html”£¬Äã»òÐíÈÏΪÔÚÕ¾µã·þÎñÆ÷¸ùĿ¼“/”Ï´æÔÚÃûΪ“show-12-34.html”µÄÎļþ£¬Æäʵʵ¼ÊËü¿ÉÄÜÊDz»´æÔڵģ¬¶ø¿ÉÄÜÄã¿´µ½µÄÄÚÈÝÊÇ“/aspx/show.aspx?type= 12&id=34”µÄÄÚÈÝ£¬ÎªÊ²Ã´ÒªÕâÑù×öÄØ£¿ÔÒòÓжà¸ö·½Ã棺Ê×ÏÈÊÇÔöÇ¿URLµÄÓѺÃÐÔ£¬¼Ç“show-12-34.html”×Ü±È “/aspx/show.aspx?type=12&id=34”ºÃ¼Ç°É£¿Æä´Î¾ÍÊÇ·½±ãËÑË÷ÒýÇæÊÕ¼£¬ºÜ¶àËÑË÷ÒýÇæ¸ü¿´ºÃ¾²Ì¬HTMLÒ³£¬±ÈÈ磺°Ù¶È£»Æä´Î¾ÍÊdzöÓÚ°²È«ÐԵĿ¼ÂÇ£¬ÒòΪÕâÑùÒþ²ØÁ˲ÎÊý“type”¡¢“id”¡£ÊDz»ÊǺÜÓÐÒâ˼ÄØ£¿
ÆäʵÕâÊÇÀûÓÃURLÖØдʵÏֵģ¬ÏÂÃæÎÒ¾Í˵һÏÂÔÚASP.NET2.0ÏÂÎÒËùÖªµÀµÄ×î¼òµ¥µÄʵÏÖ·½·¨£ºÍ¨¹ýʵÏÖ½Ó¿Ú“IHttpHandler”À´½Ó¹ÜHTTPÇëÇó£¬Follow me!
1.ÔÚ×ÊÔ´¹ÜÀí·½°¸ÖÐÌí¼ÓÒ»¸öÀ࣬ÀàµÄ´úÂëÈçÏ£º
//ÀàURLRewriter³ÌÐòÇåµ¥£º
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.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// UrlRewriter URLÖØдÀà
/// Author:yoyo
/// blog:http://yangmingsheng.cn
/// </summary>
public class UrlRewriter : IHttpHandler //ʵÏÖ“IHttpHandler”½Ó¿Ú
{
public UrlRewriter()
&
Ïà¹ØÎĵµ£º
µÚÒ»²½£º
½«Ä³¸öÒ³ÃæµÄ·½·¨ ÓÐ webmethod attribute;
[WebMethod]
//Ö»ÄÜÊÇ public static µÄ·½·¨
public static DateTime GetCurrentTime()
{
return DateTime.UtcNow;
}
µÚ¶þ²½£º
Ò³ÃæÓÐÒ»¸öScriptManager ÉèÖÃËüµÄenablepagemethod=true;
asp:ScriptManager ID="Scri ......
What is ASP.NET
ASP.NET is a unified Web development model that includes the services necessary for you to build enterprise-class Web applications with a minimum of coding. ASP.NET is part of the .NET Framework, and when coding ASP.NET applications you have access to classes in the .NET Frame ......
½ñÌìÎÒÖ÷ҪѧϰÁËUpdateModeÊôÐÔ¼°Ê¹ÓÃUpdateTriggers£¬°ÑÊéÖÐËù½ÌÊÚµÄÄÚÈÝÓöà¸öÀý×Óʵ¼ùÁËһϣ¬È·ÊµÃ÷°×ÁËÐí¶à¡£
UpdateMode
Ê×ÏÈÔÚÉÏһƪҲÌáµ½¹ýÕâÑùÒ»¸öÀíÂÛ£ºÔÚ̸ÂÛUpdatePanel¿Ø¼þµÄË¢ÐÂʱ£¬µ±UpdatePanel¿Ø¼þÖеÄ×ӿؼþ´¥·¢Async-Postback¶¯×÷ʱ£¬Ë¢ÐµÄÇøÓòÊ ......
»ñÈ¡Óйط¢³öÒ³ÇëÇóµÄÓû§µÄÐÅÏ¢¡£
Ò»¡¢HttpContext Àà
·â×°Óйظö±ð HTTP ÇëÇóµÄËùÓÐ HTTP Ìض¨µÄÐÅÏ¢¡£
HttpContext ÀàÐ͹«¿ªÒÔϳÉÔ±¡£
¹¹Ô캯Êý
Ãû³Æ
˵Ã÷
HttpContext
ÒÑÖØÔØ¡£ ³õʼ»¯ LinePragmaCodeInfo ÀàµÄÒ»¸öÐÂʵÀý¡£
·½·¨
Ãû³Æ
˵Ã÷
AddError
½«Òì³£Ìí¼Óµ½µ±Ç° HTTP ÇëÇóµÄÒ ......
Ó¦ÓóÌÐò״̬Êǿɹ© ASP.NET Ó¦ÓóÌÐòÖеÄËùÓÐÀàʹÓõÄÊý¾Ý´¢´æ¿â¡£Ëü´æ´¢ÔÚ·þÎñÆ÷µÄÄÚ´æÖУ¬Òò´ËÓëÔÚÊý¾Ý¿âÖд洢ºÍ¼ìË÷ÐÅÏ¢Ïà±È£¬ËüµÄÖ´ÐÐËٶȸü¿ì¡£ÓëÌض¨ÓÚµ¥¸öÓû§»á»°µÄ»á»°×´Ì¬²»Í¬£¬Ó¦ÓóÌÐò״̬ӦÓÃÓÚËùÓеÄÓû§ºÍ»á»°¡£Òò´Ë£¬Ó¦ÓóÌÐò״̬ÓÃÓÚ´æ´¢ÄÇЩÊýÁ¿½ÏÉÙ¡¢²»ËæÓû§µÄ±ä»¯ ......