asp.netÒ¹»°Ö®Ê®Ò»£ºweb.configÏê½âÊÕ²Ø
ÔÚ¿ª·¢Öо³£»áÓöµ½ÕâÑùµÄÇé¿ö£¬ÔÚ²¿Êð³ÌÐòʱΪÁ˱£ÃÜÆð¼û²¢²»½«Ô´´úÂëËæÏîĿһͬ·¢²¼£¬¶øÎÒÃÇ¿ª·¢Ê±µÄ»·¾³Ó벿Êð»·¾³¿ÉÄܲ»Ò»Ö£¨±ÈÈçÊý¾Ý¿â²»Ò»Ñù£©£¬Èç¹ûÔÚ´úÂëÖб£´æÕâЩÅäÖÃÕâЩÐÅÏ¢²¿ÊðʱÐèÒªµ½Óû§ÄÇÀï¸ü¸Ä´úÂëÔÙÖØбàÒ룬ÕâÖÖ²¿Êð·½Ê½·Ç³£Âé·³¡£
ÔÚ.net ÖÐÌṩÁËÒ»ÖÖ±ã½ÝµÄ±£´æÏîÄ¿ÅäÖÃÐÅÏ¢µÄ°ì·¨£¬ÄǾÍÊÇÀûÓÃÅäÖÃÎļþ£¬ÅäÖÃÎļþµÄÎļþºó׺һ°ãÊÇ.config £¬ÔÚasp.net ÖÐÅäÖÃÎļþÃûÒ»°ãĬÈÏÊÇweb.config ¡£Ã¿¸öweb.config Îļþ¶¼ÊÇ»ùÓÚXML µÄÎı¾Îļþ£¬²¢ÇÒ¿ÉÒÔ±£´æµ½Web Ó¦ÓóÌÐòÖеÄÈκÎĿ¼ÖС£ÔÚ·¢²¼Web Ó¦ÓóÌÐòʱweb.config Îļþ²¢²»±àÒë½ødll ÎļþÖС£Èç¹û½«À´¿Í»§¶Ë·¢ÉúÁ˱仯£¬½ö½öÐèÒªÓüÇʱ¾´ò¿ªweb.config Îļþ±à¼Ïà¹ØÉèÖþͿÉÒÔÖØÐÂÕý³£Ê¹Ó㬷dz£·½±ã¡£
±¾ÆªÒª½²ÊöµÄ֪ʶÈçÏ£º
ÅäÖÃÎļþµÄ²éÕÒÓÅÏȼ¶
ÅäÖÃÎļþ½Úµã˵Ã÷
ÅäÖÃÎļþµÄ²Ù×÷
ÅäÖÃÎļþµÄ²éÕÒÓÅÏȼ¶
ÔÚ.net ÌṩÁËÒ»¸öÕë¶Ôµ±Ç°»úÆ÷µÄÅäÖÃÎļþ£¬Õâ¸öÎļþÊÇmachine.config £¬ËüλÓÚ%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\ ÎļþÏ£¨%windir% ÊÇϵͳ·ÖÇøϵÄϵͳĿ¼£¬ÔÚÃüÁîÐÐģʽÏÂÊäÈë%windir% È»ºó»Ø³µ¾ÍÄܲ鿴µ±Ç°»úÆ÷µÄϵͳĿ¼£¬ÔÚWindows2003 ¼°WindowsXP ÖÐ%windir% ÊÇϵͳ·ÖÇøϵÄwindows Ŀ¼£¬ÔÚWindows2000 ÖÐ%windir% ÊÇϵͳ·ÖÇøϵÄWinNT Ŀ¼£¬ÔÚ±ÊÕß»úÆ÷ÉÏÕâ¸öϵͳĿ¼ÊÇC:\WINDOWS £©¡£Õâ¸öÎļþÀïÃ涨ÒåÁËÕë¶Ôµ±Ç°»úÆ÷µÄWinForm ³ÌÐòºÍasp.net Ó¦ÓóÌÐòµÄÅäÖá£ÏÂÃæÊÇmachine.config ÎļþµÄÄÚÈÝ£º
ÔÚÕâ¸öÎļþ¼ÐÏ»¹ÓÐÒ»¸öweb.config Îļþ£¬Õâ¸öÎļþ°üº¬ÁËasp.net ÍøÕ¾µÄ³£ÓÃÅäÖá£ÏÂÃæÊÇÕâ¸öweb.config ÎļþµÄÄÚÈÝ£º
asp.net ÍøÕ¾IIS Æô¶¯µÄʱºò»á¼ÓÔØÅäÖÃÎļþÖеÄÅäÖÃÐÅÏ¢£¬È»ºó»º´æÕâЩÐÅÏ¢£¬ÕâÑù¾Í²»±Øÿ´ÎÈ¥¶ÁÈ¡ÅäÖÃÐÅÏ¢¡£ÔÚÔËÐйý³ÌÖÐasp.net Ó¦ÓóÌÐò»á¼àÊÓÅäÖÃÎļþµÄ±ä»¯Çé¿ö£¬Ò»µ©±à¼ÁËÕâЩÅäÖÃÐÅÏ¢£¬¾Í»áÖØжÁÈ¡ÕâЩÅäÖÃÐÅÏ¢²¢»º´æ¡£
µ±ÎÒÃÇÒª¶Áȡij¸ö½Úµã»òÕß½Úµã×éÐÅϢʱ£¬ÊÇ°´ÕÕÈçÏ·½Ê½ËÑË÷µÄ£º
(1) Èç¹ûÔÚµ±Ç°Ò³ÃæËùÔÚĿ¼Ï´æÔÚweb.config Îļþ£¬²é¿´ÊÇ·ñ´æÔÚËùÒª²éÕҵĽáµãÃû³Æ£¬Èç¹û´æÔÚ·µ»Ø½á¹û²¢Í£Ö¹²éÕÒ¡£
(2) Èç¹ûµ±Ç°Ò³ÃæËùÔÚĿ¼Ï²»´æÔÚweb.config Îļþ»òÕßweb.config ÎļþÖв»´æÔڸýáµãÃû£¬Ôò²éÕÒËüµÄÉϼ¶Ä¿Â¼£¬Ö±µ½ÍøÕ¾µÄ¸ùĿ¼¡£
(3) Èç¹ûÍøÕ¾¸ùĿ¼Ï²»´æÔÚweb.config Îļþ»òÕßweb.config ÎļþÖв»´æÔڸýڵãÃûÔòÔÚ%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
Ïà¹ØÎĵµ£º
Èý²ãµÄ»®·Ö:
Ä¿µÄ£º¸ßÄÚ¾Û£¬µÍñîºÏ£¬Îª¸üºÃµÄʵÏÖ·Ö²¼Ê½¿ª·¢ºÍά»¤¡£
Óû§½çÃæ²ã: Ò³Ãæ,Óû§¿Ø¼þ,ͼƬ£¬Ñùʽ±í
ÒµÎñÂß¼²ã:ÒµÎñ½Ó¿Ú( BusinessInterface ), ÒµÎñʵÌå( BusinessEntity),ÒµÎñÂß¼(BusinessLogic)
  ......
ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......
½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......
½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......
1.Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº < %= a ......