ÇÉÓÃasp.net×öurlÖØд(·ÂËѺü²©¿Í)
ÇÉÓÃasp.net×öurlÖØд(·ÂËѺü²©¿Í),Ïë×ö³öÏñsohu²©¿ÍÄÇÑù£¬urlµØÖ·×îÇ°ÃæÊÇÓû§×Ô¶¨ÒåµÄǰ׺£¬¸ÃÔõô×ö£¿xuedaonet˵һÏÂ×Ô¼ºµÄ˼·£¡ÈçÓдíÎóµÄµØ·½»¶Ó´ó¼Ò½øÐÐÖ¸Õý¡£
1¡¢ÏÂÔØ Intelligencia.UrlRewriter.dll×é¼þ
2¡¢Ìí¼ÓIntelligencia.UrlRewriter.dllµÄÒýÓÃ
3¡¢ÔÚweb.configÖÐÉèÖÃÈý¸öµØ·½
1£©¡¢ÔÚ<configSections></configSections>½ÚÖмÓÉÏ<section
name="rewriter" requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,
Intelligencia.UrlRewriter" />£»
2£©¡¢ÔÚ<httpModules></httpModules>½ÚÖмÓÉÏ<add
name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,
Intelligencia.UrlRewriter"/>£»
3£©¡¢ÔÚ<configuration></configuration>½ÚÖÐÌí¼Ó<rewriter>
<rewrite url="~/(.+).html$" to="~/ViewNews.aspx?ID=$1" />
</rewriter>
£¨Õâ¶ÎÌæ»»¹æÔòÐèÒª¸ù¾ÝÄãµÄʵ¼ÊÐèҪȥÐ޸ģ¬Èç¹ûÒªÖØд³ÉHTMLµÄ¸ñʽ£¬ÐèÒªÔÚIISÖÐÉèÖÃÓ³É䣬Õâ¸öÍøÉÏ·½·¨·Ç³£¶à¡£ÆäÖÐÌæ»»¹æÔò¿ÉÒÔÉèÖöà
¸ö¡££©elligencia.UrlRewriter.dllµÄÒýÓá£
<rewrite url="^(.*)/(\\?.+)?$" to="$1/default.aspx$2" />
×¢Ò⣺ʹÓá°processing="restart"¡±µÄʱºò½«»áµ¼ÖÂÖØдÒýÇæ´ÓÍ·¿ªÊ¼Ö´ÐÐËùÓеÄÖØд¹æÔò(www.jixiebaike.com)£¬´ËʱӦµ±×¢ÖØ°üº¬¡°/default.aspx¡±×Ö·û´®µÄ´¦Àí¡£
Èç¹ûÄãÐèҪͬʱ֧³Ö¶à¸öĬÈÏÎĵµ£¬ÄÇôÒÔÉÏ´úÂëÐèÒªÐÞ¸ÄΪ£º
<if
url="^(.*)/(\\?.+)?$"> <rewrite exists="$1/default.aspx"
to="$1/default.aspx$2" /> <rewrite exists="$1/index.aspx"
to="$1/index.aspx$2" /> <rewrite exists="$1/index.html"
to="$1/index.html$2" /></if>
±à¼ÒÔÉϹæÔò´úÂëµÄʱºò£¬ÓÈÆäҪעÒâÈ·ÈÏÎļþÊÇ·ñ´æÔÚ¡£
´ËÍ⣬ÔÚʹÓÃͨÅä·ûÓ³Éä»òÕßʹÓÃASP.NET´¦ÀíËùÓÐHTTPÇëÇóµÄʱºò£¬Äã»á·¢ÏÖ.gif¡¢.cssµÈÎļþÎÞ·¨Õý³£·ÃÎÊ£¬ÕâÊÇÒòΪ´Ëʱ¶ÔÕâЩÎļþÀàÐ͵Ĵ¦Àí¶¼±»ASP.NETËùÀ¹½Ø¡£ÐÞÕý·½·¨ÈçÏ£º
<rewrite url="^(/.+(\\.gif|\\.png|\\.jpg|\\.ico|\\.css|\\.js)(\\?.+)?)$" to="$1" processing="stop" />
Á½¸ö±È½ÏÌØÊâµÄÕýÔò±í´ïʽ×Ö·ûÊÇ¡°^¡±ºÍ¡°$¡±£¨²»ÊDZØÐëµÄ£©£¬¡°^¡±´ú±íURLµÄ¿ªÍ·£¬¡°$¡±´ú±íURLµÄ½áβ¡£Ê¹ÓÃÕâÁ½¸ö·ûºÅ¿ÉÒÔʹÄú¸ü¼Ó¾«È·µÄ¿ØÖÆÖØд¶¯×÷£¬ÒÔÈ·±£³ÌÐòËùÆ¥ÅäµÄURLÕýÊÇÄúÏë´¦ÀíµÄ¡£
¡°~/¡±±íʾµ±Ç°ÍøÕ¾Ó¦ÓóÌÐòÔËÐÐËùÔÚµÄÐéÄâ¸ùĿ¼£¬µ±Äú°ÑÍøÕ¾Ó¦ÓóÌÐò°²×°ÓÚÐéÄâĿ¼£¨»òÕ߷ǸùĿ¼£©µÄʱºò£¬ÕâÓÈÆäÓÐÓ㬶øÎÞÐëÖØбàдÈκδúÂëÀ´Ìæ»»ÄúµÄÐéÄâ¸ù·¾¶¡£
ģʽƥÅäÔÚ´¦Àí²éѯ×Ö´®£¨QueryStrings£©µÄʱºòÓÈÆäÓÐÓã¬Õâ¿ÉÒÔÈÃÄúµÄURLÈ¥µôÀàËÆÓÚ¡°?id=3¡±µÄ´úÂë¶Î£¬Õâ·Ç³£ÓÐÓ㬿ÉÒÔÈÃÄãÇáËɵÄʵÏÖα¾²Ì¬¡£
ÏÂÃæÁгöÁ½¸öÎÒÃÇÈÏΪ·Ç³£ÓÐÌØÉ«µÄÖØд¹æÔò£º
(1) µ±Ä¿±êURL²»°üº¬×Ô¶¨Òå²éѯ×Ö´®µÄʱºò£º
<rewrite url="^~/mypage(\\?.+)?$" to="~/default.aspx$1" />
´Ëʱ¡°$1¡±Æ¥ÅäµÄÊÇ(\?.+)?£¬Ò²¾ÍÊÇËùÓеIJéѯ×Ö´®¡£
(2) µ±Ä¿±êURL°üº¬×Ô¶¨Òå²éѯ×Ö´®µÄʱºò£º
<rewrite url="^~/mypage(\\?(.+))?$" to="~/default.aspx?page=mypage&$2" />
×¢Òâ´ËʱÐèҪʹÓá°&¡±À´´úÌæ¡°&¡±£¬ÕâÊÇXMLÎĵµÓï·¨µÄÐèÒª¡£
ÍƼöÐÅÏ¢
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- Asp.net MVCÔ´Âë·ÖÎö--Model Validation(Se....
- .Net À¬»ø»ØÊÕ»úÖÆÔÀíºÍËã·¨£¨Ò»£©
- .netʵÌåнâ
- ·ÖÎöASP.NET¶ÁÈ¡XMLÎļþ4ÖÖ·½·¨
- »ñÈ¡ÍøÕ¾ËõÂÔͼ´úÂë
- Asp.net ¸ù¾ÝIPµØÖ·»ñÈ¡¿çÍø¶ÎmacµØÖ·º¯Êý¡¾ËѲء¿
- ¹ýÂËÃô¸Ð¹Ø¼ü×Ö¡£
- Éú³ÉÖ¸¶¨Î»ÊýµÄËæ»ú×Ö·û´®
- ¿Í»§¶Ë»ñÈ¡MACµØÖ·£¬µ½·þÎñÆ÷ÑéÖ¤
- ²½²½ÎªÓª .NETÈý²ã¼Ü¹¹½âÎö ¶þ¡¢Êý¾Ý¿âÉè¼Æ
ÆÀÂÛ