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

Àí½âASP.NET MVCÖ´Ðйý³Ì

Ïò»ùÓÚASP.NET MVCµÄWeb³ÌÐò·¢ËÍÇëÇóÊ×ÏÈ´«µÝÒ»¸ö UrlRoutingModule ¶ÔÏó£¬ÕâÊÇÒ»¸öHTTPÄ£¿é¡£Õâ¸öÄ£¿é½âÎöÇëÇó²¢Ö´ÐзÓÉÑ¡Ôñ¡£ UrlRoutingModule ¶ÔÏóÑ¡ÔñµÚÒ»¸öÆ¥Å䵱ǰÇëÇóµÄ·ÓɶÔÏó¡£(·ÓɶÔÏóÊÇʵÏÖ RouteBase µÄÀ࣬¶øÇÒͨ³£ÊÇ Route ÀàµÄÒ»¸öʵÀý¡£) Èç¹ûûÓÐÈκηÓÉÆ¥Å䣬 UrlRoutingModule ¶ÔÏó¾Íɶ¶¼²»×ö£¬ÈÃÇëÇó»Øµ½Í¨³£µÄASP.NET»òIISÇëÇó´¦ÀíÖС£
ÓÉÑ¡ÔñµÄ Route ¶ÔÏó,  UrlRoutingModule ¶ÔÏó»ñÈ¡ÓÉRoute ·Ö¸ôµÄ IRouteHandler ¶ÔÏó¡£ÔÚMVC³ÌÐòÖÐÕâͨ³£»áÊÇÒ»¸ö MvcRouteHandlerµÄʵÀý¡£  IRouteHandler ʵÀý´´½¨Ò»¸ö IHttpHandler ¶ÔÏó²¢½«Ëü´«µ½IHttpContext ¶ÔÏó¡£Ä¬ÈÏÇé¿öÏ£¬ÓÃÓÚMVCµÄ IHttpHandler ʵÀýÊÇ MvcHandler ¶ÔÏó¡£ MvcHandler ¶ÔÏó½ø¶øÑ¡Ôñ×îÖÕ´¦Àí³ÌÐòµÄ¿ØÖÆÆ÷¡£
×¢Òâ:
µ±ASP.NET MVC Web ³ÌÐòÔËÐÐÔÚ IIS 7.0ÏÂʱ, MVCÏîÄ¿²»ÒªÇóÎļþÃûÀ©Õ¹¡£È»¶ø£¬ÔÚ IIS 6.0ÏÂ,ÐèÒªÓ³Éä.mvcÎļþÃûÀ©Õ¹µ½ASP.NET ISAPI DLL¡£
Ä£¿éÓë´¦Àí³ÌÐòÊÇ ASP.NET MVC ¿ò¼ÜµÄÈë¿Úµã¡£ËüÃÇÖ´ÐÐÒÔϲÙ×÷:
ÔÚMVC Web³ÌÐòÖÐÑ¡ÔñÊʺϵĿØÖÆÆ÷¡£
»ñÈ¡Ö¸¶¨µÄ¿ØÖÆÆ÷ʵÀý¡£
µ÷ÓÿØÖÆÆ÷µÄ Execute ·½·¨¡£
ϱíÁгöÁËMVC WebÏîÄ¿Ö´ÐеĽ׶Ρ£
½×¶Î
Ïêϸ
½ÓÊÕ³ÌÐòµÄµÚÒ»¸öÇëÇó
ÔÚ Global.asax ÎļþÖÐ, Route ¶ÔÏó±»Ìí¼Óµ½ RouteTable ¶ÔÏóÖС£
Ö´ÐзÓÉ(routing)
UrlRoutingModule Ä£¿éʹÓÃRouteTable ¼¯ºÏÖеÚÒ»¸öÆ¥ÅäµÄ Route ¶ÔÏóÀ´´´½¨ RouteData ¶ÔÏó, È»ºóËü´´½¨Ò»¸ö RequestContext (IHttpContext) ¶ÔÏó¡£
´´½¨MVCÇëÇó´¦Àí³ÌÐò
MvcRouteHandler ¶ÔÏó´´½¨ MvcHandler ÀàµÄÒ»¸öʵÀý²¢´«µÝ RequestContext ʵÀý¡£
´´½¨¿ØÖÆÆ÷
MvcHandler ¶ÔÏóʹÓà RequestContext ʵÀýÀ´Ê¶±ð IControllerFactory ¶ÔÏó(ͨ³£ÊÇÒ»¸ö DefaultControllerFactory ÀàµÄʵÀý) ÒÔ´´½¨¿ØÖÆÆ÷ʵÀý¡£
Ö´ÐпØÖÆÆ÷
MvcHandler ʵÀýµ÷ÓÿØÖÆÆ÷µÄ Execute ·½·¨¡£
µ÷ÓòÙ×÷(action)
´ó¶àÊý¿ØÖÆÆ÷¼Ì³Ð×Ô Controller »ùÀà¡£Òò´Ë£¬Óë¿ØÖÆ·Ö¸ôµÄ ControllerActionInvoker ¶ÔÏó¾ö¶¨µ÷ÓÃÄĸö¿ØÖÆÆ÷µÄaction·½·¨²¢µ÷ÓÃÖ®¡£
Ö´Ðнá¹û
ͨ³£µÄaction·½·¨»á½ÓÊÕÓû§ÊäÈ룬׼±¸Êʵ±µÄÏìÓ¦Êý¾Ý£¬È»ºó·µ»Ø½á¹ûÀàÐÍÀ´Ö´Ðнá¹û¡£¿ÉÒÔÖ´ÐеÄÄÚÖÃÀàÐÍ°üÀ¨£º ViewResult (³ÊÏÖÊÓͼ£¬×î³£ÓõĽá¹ûÀàÐÍ), RedirectToRouteResult, RedirectResult, ContentResult, JsonResult, ºÍEmptyResult.
Ô­ÎĵØÖ·£ºhttp://www.asp.net/learn/mvc/tutorial-22


Ïà¹ØÎĵµ£º

Asp.NetÐÔÄÜÓÅ»¯

(Ò»).Ñ¡Ôñ»á»°×´Ì¬´æ´¢·½Ê½
    ÔÚWebconfigÎļþÅäÖÃ:
    <sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
         sqlConnectionString="data source=127.0.0.1;Trusted_Connection=y ......

ASP.NETÒ³ÃæÖ®¼ä´«µÝÖµµÄ¼¸ÖÖ·½·¨

Ò».ʹÓÃQueryString
Request.QueryString
   ÔÚASPʱ´ú£¬Õâ¸öÊǽϳ£Óõķ½·¨£¬µ½ÁËASP.NET£¬ºÃÏñÓõÄÈ˲»¶àÁË£¬µ«ÊDz»¹ÜÔõô˵£¬ÕâÊÇÒ»¸öûÓйýʱ£¬ÇÒºÜÖµµÃÍƼöµÄ·½·¨£¬ÒòΪ²»¹ÜÊÇASP»¹ÊÇASP.NET£¬×î»ù±¾µÄ¶¼»¹ÊÇ»ùÓÚHTTpЭÒéµÄ¡£ ȱµãÊǷdz£Ã÷ÏԵģ¬ÈÃÔÚ¶à¸öÒ³Ãæ´«µÝʱ£¬¿ÉÄܾÍRequest²»µ½ÁË
  ʹÓÃQu ......

ASP.NET 26¸ö³£ÓÃÐÔÄÜÓÅ»¯·½·¨


Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
¡¡¡¡·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø±ÕʱÊÕ» ......

ASP.NET¿çÒ³ÃæµÄ¿Ø¼þµ÷ÓÃ

ASP.NET3.5¿ÉÒԺܼò´ðµÄʵÏÖÒ»¸öºÜÓÐÓõŦÄÜ£¬¼È¿çÒ³Ãæ´«ËÍ£¬
´«Í³µÄÌá½»´°ÌåÖ»»á½«´°ÌåÌá½»¸øËü×Ô¼º¡£¶ø¿çÒ³ÃæµÄÌá½»£¬
»á½«page1µÄÄÚÈÝ´«Ë͸öpage2£¬²¢ÔÚpage2ÖÐʹÓÃpage1ÖеĿؼþ¡£
¢Ù ¿çÒ³Ãæ´«µÝµÄ¼òµ¥ÊµÏÖ
    Ò³ÃæÒ»£¨Default.aspx£©ÖеĿؼþ
        <a ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ