ASP.NET½Ì³Ì:URLÖØдµÄʵÏÖ
×î½üÓиöÅóÓÑÒª×öurlÖØдµÄ¶«Î÷,ÎÒ°ïËûŪÁËŪ,»ØÍ·¿´µ±Äê×Ô¼ºÐ´µÄÄǸöÎÄÕÂ,µ±Ê±ÒÔΪ×Ô¼ºÐ´µÄºÜÈÝÒ×Àí½â.µ«ÏÖÔÚÔÙ¿´È´¾õµÃдµÄ²»ºÃ.¶ø½ñÌì°Ù¶ÈÁËÒ»ÏÂurlrewriter·¢ÏÖÎÒÕâ¸öÎÄÕ¾¹È»Åŵڶþ.ΪÁË·½±ã¸ü¶àÅóÓÑ,ÎÒÔÙдµã¶«Î÷²¹³äÏÂ.
Ò»°ãÓðٶÈËѵÄÅóÓѶ¼ÊǶÔÕâ¸ö²»Á˽⵫ÓÖ¼±ÐèÒªÓõÄ,ÎÒÏë,ÔÙ¶àµÄÓïÑÔÒ²±È²»¹ýÒ»¾ä´úÂë.ÓÚÊÇÎҰѽñÌì°ïÅóÓÑʱºòдµÄÒ»¸öСÀý×Ó´«ÁËÉÏÀ´.Õâ¸öСÀý×ÓµÄÄ¿µÄÊÇʵÏÖ¶ÔÈÎÒâurlµÄÖØд(µ«²»°üÀ¨¶þ¼¶ÓòÃûµÄ,ÓÐÐèÒª¶þ¼¶ÓòÃûµÄÒ²¿ÉÒÔÏÈÁ˽âÏÂurlÖØдµÄ¸ÅÄî). Õâ¸öСÏîÄ¿µÄÖÆ×÷¹ý³ÌÈçÏÂ
ÐèÒª¶ÔÖîÈçhttp://song2.cn/viewnews/2009/3/2.htmlµÄurl½øÐÐÖØд.½«ÆäÖØдΪhttp://song2.cn/viewnews.aspx?id=2&year=2009&month=3
ÏÂÔØ΢ÈíµÄÄǸöURLRewriter.dll,ʹÓÃÕâ¸ö¶Ôurl½øÐÐÖØд.
ÎÒÃÇÀ´¿´Õâ¸öurl, http://song2.cn/viewnews/2009/3/2.html(µ±È»Ò²¿ÉÄÜÊÇ3.html,6.html,7.html).ÒªÖØд,Ê×ÏÈÊǽػñurlÇëÇó,È»ºó·ÖÎöµ±Ê±µÄurl,×îºóÌøתµ½ÏàÓ¦µÄÒ³Ãæ.ËùÒÔÎÒÃǵÚÒ»²½ÊÇÒª½Ø»ñurlÇëÇó.Ϊ´Ëн¨Ò»¸öÀà¿â½ÐURL,ÔÚ¸ÃÀà¿âÖÐÒýÓÃURLRewriter.dll.н¨Ò»¸öÀàmyrewritter.cs,´úÂëÈçÏÂ
namespace URL
{
public class myrewritter : URLRewriter.BaseModuleRewriter
{
protected override void Rewrite(string requestedPath, HttpApplication app)
{
if (requestedPath.Contains("viewnews/2009/3/2.html"))
app.Context.RewritePath("/viewnews.aspx?id=2&year=2009&month=3");
else
app.Context.RewritePath("/here.aspx");
}
}
}
¿ÉÒÔ¿´µ½¸ÃÀà¼Ì³ÐÁËURLRewriter.BaseModuleRewriter,È»ºóÔÚRewrite·½·¨ÖмÓÈëÁËÎÒÃÇ×Ô¼ºµÄÂß¼.ÏÖÔÚ,Ö»Òªµ±Ç°µÄurlÇëÇóÊÇviewnews/2009/3/2.html,ÎÒÃǾͻὫҳÃæÖØдµ½/viewnews.aspx?id=2&year=2009&month=3.
ÕâÖ»ÊÇÒ»¸ö¼òµ¥µÄÀý×Ó,
Ïà¹ØÎĵµ£º
ASP.net´íÎó´¦Àí(´íÎóÌøתҳ webconfig)
ʹÓö¨ÖÆ´íÎóÒ³Ãæ
ËäÈ»ÎÒÃÇ·¢Ë͸øÓû§µÄ¹«ÓôíÎóÐÅÏ¢ÊÇ°²È«µÄ£¬¾ÍÊÇ˵Ëü²»»áÍþвµ½Ó¦ÓóÌÐòµÄÃØÃÜ£¬µ«ÊÇÕâÑùµÄÐÅÏ¢²¢²»ºÃ¿´¡£Ò²ÐíÄãÏ£ÍûÓû§ÓÀÔ¶Ò²¿´²»µ½ÕâÑùµÄÐÅÏ¢¡£Ïà·´£¬µ±´¦ÀíÇëÇóµÄ¹ý³ÌÖУ¬Èç¹û·¢ÉúÁËÒ»¸öΪ´¦ÀíµÄ´íÎó£¬ÄãÏ£ÍûÄܹ»ÏÔÊ¾× ......
protected void Button6_Click(object sender, EventArgs e)
{
this.Label11.Text = HtmlEncode(this.TextBox3.Text);
}
protected static string HtmlEn ......
asp.netÖг£ÓõÄ26¸öÓÅ»¯ÐÔÄܵķ½·¨
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯¡¡
¡¡
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄ ......
#region ÓòÃû°ó¶¨·½·¨
public static void AddHostHeader(int siteid, string ip, int port, string domain)//Ôö¼ÓÖ÷»úÍ·£¨Õ¾µã±àºÅ.ip.¶Ë¿Ú.ÓòÃû£©
{
DirectoryEntry site = new DirectoryEntry("IIS://localhost/W3SVC/" + siteid) ......