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

ASP.NETÖÐÖ´ÐÐURLÖØд

 
¿ÉÒÔʹÓà ISAPI ɸѡÆ÷ÔÚ IIS Web ·þÎñÆ÷¼¶±ðʵÏÖ URL ÖØд£¬Ò²¿ÉÒÔʹÓà HTTP Ä£¿é»ò HTTP ´¦Àí³ÌÐòÔÚ
ASP.NET ¼¶±ðʵÏÖ URL ÖØд¡£±¾ÎÄÖصã½éÉÜÈçºÎʹÓà ASP.NET ʵÏÖ URL ÖØд£¬Òò´ËÎÒÃǽ«²»¶ÔʹÓà ISAPI ɸѡÆ÷ʵÏÖ
URL ÖØдµÄϸ½Ú½øÐÐÉîÈë̽ÌÖ¡£µ«ÊÇ£¬ÓдóÁ¿µÄµÚÈý·½ ISAPI ɸѡÆ÷¿ÉÓÃÓÚ URL ÖØд£¬ÀýÈ磺
ISAPI
Rewrite

IIS Rewrite

PageXChanger

»¹ÓÐÐí¶àÆäËûµÄɸѡÆ÷£¡
ͨ¹ý System.Web.HttpContext
ÀàµÄ RewritePath()
·½·¨£¬¿ÉÒÔÔÚ ASP.NET ¼¶±ðʵÏÖ URL ÖØд¡£HttpContext

Àà°üº¬ÓйØÌض¨ HTTP ÇëÇóµÄ HTTP Ìض¨ÐÅÏ¢¡£¶ÔÓÚ ASP.NET ÒýÇæÊÕµ½µÄÿ¸öÇëÇ󣬾ùΪ¸ÃÇëÇó´´½¨Ò»¸ö HttpContext
ʵÀý¡£´ËÀà¾ßÓÐÈçÏÂÊôÐÔ£ºRequest
ºÍ Response
£¬Ìṩ¶Ô´«ÈëÇëÇóºÍ´«³öÏìÓ¦µÄ·ÃÎÊ£»Application
ºÍ Session
£¬Ìṩ¶ÔÓ¦ÓóÌÐòºÍ»á»°±äÁ¿µÄ·ÃÎÊ£»User
£¬ÌṩÓйØͨ¹ýÁËÉí·ÝÑéÖ¤µÄÓû§µÄÐÅÏ¢£»ÆäËûÏà¹ØÊôÐÔ¡£
ʹÓà RewritePath()

·½·¨¿ÉÒÔ½ÓÊܵ¥¸ö×Ö·û´®×÷ΪҪʹÓõÄз¾¶¡£HttpContext
ÀàµÄ RewritePath(string)

·½·¨ÔÚÄÚ²¿¶Ô Request
¶ÔÏóµÄ Path
ÊôÐÔºÍ QueryString
ÊôÐÔ½øÐиüС£³ýÁË RewritePath(string)
£¬.NET
Framework 1.1 »¹°üÀ¨ÁíÒ»ÖÖÐÎʽµÄ RewritePath()
·½·¨£¬´Ë·½·¨¿ÉÒÔ½ÓÊÜÈý¸ö×Ö·û´®ÊäÈë²ÎÊý¡£´Ë±¸ÓÃÖØÔØÐÎ
ʽ²»½öÒªÉèÖà Request
¶ÔÏóµÄ Path
ÊôÐÔºÍ QueryString

ÊôÐÔ£¬»¹ÒªÉèÖÃÄÚ²¿³ÉÔ±±äÁ¿£¬ÕâЩ±äÁ¿ÓÃÓÚ¼ÆËã Request
¶ÔÏóµÄ PhysicalPath
¡¢PathInfo
ºÍ FilePath
ÊôÐÔÖµ¡£
ÒªÔÚ ASP.NET ÖÐʵÏÖ URL ÖØд£¬ÐèÒª´´½¨ HTTP Ä£¿é»ò HTTP
´¦Àí³ÌÐò£¬ÒÔ±ãÍê³ÉÒÔϲÙ×÷£º
¼ì²é±»ÇëÇóµÄ·¾¶£¬ÒÔÈ·¶¨ URL ÊÇ·ñÐèÒªÖØд¡£
Èç¹ûÐèÒªÖØд£¬Í¨¹ýµ÷Óà RewritePath()
·½·¨À´ÖØд·¾¶¡£
ÀýÈ磬¼ÙÉèÎÒ
ÃǵÄÍøÕ¾Öаüº¬Ã¿¸öÔ±¹¤Í¨¹ý /info/employee.aspx?empID=employeeID ¾ù¿É·ÃÎʵÄÐÅÏ¢¡£ÎªÁËʹ URL
¿ÉÒÔ¸ü¶àµØ±»“ɾ½Ú”£¬ÎÒÃÇ¿ÉÒÔ¾ö¶¨Í¨¹ýÒÔϵØÖ·À´·ÃÎÊÔ±¹¤Ò³Ã棺/people/EmployeeName.aspx¡£Õâ¾ÍÊÇÎÒÃÇҪʹÓà URL
ÖØдµÄÒ»¸öÀý×Ó¡£Ò²¾ÍÊÇ˵£¬ÔÚÇëÇó /people/ScottMitchell.aspx Ò³Ãæʱ£¬ÎÒÃÇÒªÖØд¸Ã URL£¬ÒÔ±ãʹÓÃ
/info/employee.aspx?empID=1001 Ò³Ãæ¡£
ʹÓà HTTP Ä£¿éÖ´ÐÐ URL ÖØд
ÔÚ
ASP.NET ¼¶±ðÖ´ÐÐ URL ÖØдʱ£¬¿ÉÒÔʹÓà HTTP Ä£¿é»ò HTTP ´¦Àí³ÌÐòÀ´Ö´ÐÐÖØд¡£Ê¹Óà HTTP
Ä£¿éʱ£¬±ØÐë¾ö¶¨ÔÚÇëÇóÓÐЧÆ


Ïà¹ØÎĵµ£º

ASP.NetÒ³Ã澲̬»¯

 ²½Ö裺
£±.¡¡Ð½¨Ò»¸öWEB½â¾ö·½°¸Ãû³ÆΪHtmlStatic¡£
£².¡¡ÔÚÏîĿϽ¨Ò»¸öHtmlTemp.htmÆä´úÂëÈçÏ£º
¡¡¡¡¡¡<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head&g ......

ASP.NETµ¯³öģʽ¶Ô»°´°¿Ú·â×°Àà

 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// <summary>
    /// javascriptµ¯³ö´°¿Ú·â×°Àà
    /// </summary>
    public static class JSCommon ......

asp.netµÄÒ³ÃæÖ´Ðйý³Ì½²½â

Ê×ÏÈÏÈÖØÎÂһϹØÓÚb/sģʽµÄÕû¸öÇëÇó¹ý³Ì:
¿Í»§¶Ëͨ¹ýÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÇÃÈëµØÖ·À´·¢ËÍÇëÇóµ½·þÎñÆ÷¶Ë  ->  ·þÎñÆ÷½ÓÊÕµ½ÇëÇóÖ®ºó£¬·¢¸øÏàÓ¦µÄ·þÎñÆ÷¶ËÒ³Ã棨Ҳ¾ÍÊǽű¾£©À´Ö´ÐУ¬½Å±¾²úÉú¿Í»§¶ËµÄÏìÓ¦£¬·¢Ëͻؿͻ§¶Ë   ->  ¿Í»§¶Ëä¯ÀÀÆ÷½ÓÊÕµ½·þÎñÆ÷´«»ØµÄÏìÓ¦£¬¶ÔHtml½øÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ