ASP.NET Web.configÅäÖÃÏê½â
Ò»¡¢ÈÏʶWeb.configÎļþ
Web.config ÎļþÊÇÒ»¸öXMLÎı¾Îļþ£¬ËüÓÃÀ´´¢´æ ASP.NET Web Ó¦ÓóÌÐòµÄÅäÖÃÐÅÏ¢£¨Èç×î³£ÓõÄÉèÖÃASP.NET Web Ó¦ÓóÌÐòµÄÉí·ÝÑéÖ¤·½Ê½£©£¬Ëü¿ÉÒÔ³öÏÖÔÚÓ¦ÓóÌÐòµÄÿһ¸öĿ¼ÖС£µ±Äãͨ¹ý.NETн¨Ò»¸öWebÓ¦ÓóÌÐòºó£¬Ä¬ÈÏÇé¿öÏ»áÔÚ¸ùĿ¼×Ô¶¯´´½¨Ò»¸öĬÈ쵀 Web.configÎļþ£¬°üÀ¨Ä¬ÈϵÄÅäÖÃÉèÖã¬ËùÓеÄ×ÓĿ¼¶¼¼Ì³ÐËüµÄÅäÖÃÉèÖá£Èç¹ûÄãÏëÐÞ¸Ä×ÓĿ¼µÄÅäÖÃÉèÖã¬Äã¿ÉÒÔÔÚ¸Ã×ÓĿ¼ÏÂн¨Ò»¸ö Web.configÎļþ¡£Ëü¿ÉÒÔÌṩ³ý´Ó¸¸Ä¿Â¼¼Ì³ÐµÄÅäÖÃÐÅÏ¢ÒÔÍâµÄÅäÖÃÐÅÏ¢£¬Ò²¿ÉÒÔÖØд»òÐ޸ĸ¸Ä¿Â¼Öж¨ÒåµÄÉèÖá£
(Ò»).Web.ConfigÊÇÒÔXMLÎļþ¹æ·¶´æ´¢,ÅäÖÃÎļþ·ÖΪÒÔϸñʽ
1.ÅäÖýڴ¦Àí³ÌÐòÉùÃ÷
Ìص㣺 λÓÚÅäÖÃÎļþµÄ¶¥²¿£¬°üº¬ÔÚ <configSections> ±êÖ¾ÖС£
2.Ìض¨Ó¦ÓóÌÐòÅäÖÃ
Ìصã: λÓÚ <appSetting> ÖС£ ¿ÉÒÔ¶¨ÒåÓ¦ÓóÌÐòµÄÈ«¾Ö³£Á¿ÉèÖõÈÐÅÏ¢.
3.ÅäÖýÚÉèÖÃ
Ìصã: λÓÚ <system.Web> ½ÚÖУ¬¿ØÖÆAsp.netÔËÐÐʱµÄÐÐΪ.
4.ÅäÖýÚ×é
Ìصã: Óà <sectionGroup> ±ê¼Ç£¬¿ÉÒÔ×Ô¶¨Òå·Ö×飬¿ÉÒԷŵ½ <configSections> ÄÚ²¿»òÆäËü <sectionGroup> ±ê¼ÇµÄÄÚ²¿.
(¶þ).ÅäÖýڵÄÿһ½Ú
1. <configuration> ½Ú
¸ùÔªËØ£¬ÆäËü½Ú¶¼ÊÇÔÚËüµÄÄÚ²¿.
2. <appSetting> ½Ú
´Ë½ÚÓÃÓÚ¶¨ÒåÓ¦ÓóÌÐòÉèÖÃÏî¡£¶ÔһЩ²»È·¶¨ÉèÖ㬻¹¿ÉÒÔÈÃÓû§¸ù¾Ý×Ô¼ºÊµ¼ÊÇé¿ö×Ô¼ºÉèÖÃ
Ó÷¨:
I.
<appSettings>
<add key= "Conntction " value= "server=192.168.85.66;userid=sa;password=;database=Info; "/>
<appSettings>
¶¨ÒåÁËÒ»¸öÁ¬½Ó×Ö·û´®³£Á¿£¬²¢ÇÒÔÚʵ¼ÊÓ¦ÓÃʱ¿ÉÒÔÐÞ¸ÄÁ¬½Ó×Ö·û´®£¬²»ÓÃÐ޸ijÌʽ´úÂë.
II. <appSettings>
<add key= "ErrPage " value= "Error.aspx "/>
<appSettings>
¶¨ÒåÁËÒ»¸ö´íÎóÖض¨ÏòÒ³Ãæ.
3. <compilation> ½Ú
¸ñʽ:
<compilation
defaultLanguage= "c# "
debug= "true "
/>
I.default language: ¶¨Òåºǫ́´úÂëÓïÑÔ,¿ÉÒÔÑ¡ÔñC#ºÍVB.netÁ½ÖÖÓïÑÔ.
IIdebug : Ϊtrueʱ£¬Æô¶¯aspxµ÷ÊÔ£» Ϊfalse²»Æô¶¯aspxµ÷ÊÔ£¬Òò¶ø¿ÉÒÔÌá¸ßÓ¦ÓóÌÐòÔËÐÐ
ʱµÄÐÔÄÜ¡£ Ò»°ã³ÌÐòÔ±ÔÚ¿ª·¢Ê±ÉèÖÃΪtrue,½»¸ø¿Í»§Ê±ÉèÖÃΪfalse.
4. <customErrors> ½Ú
¸ñʽ:
<customErrors
mode= "RemoteOnly "
defaultRedirect= "error.aspx "
<error statusCode= "440 " redirect=
Ïà¹ØÎĵµ£º
¶ÔÓÚ¿ª·¢Õß×ÔÉíµÄ»úÆ÷À´½²£¬¿ÉÄܳÌÐòÔËÐв»»áÓÐÈκÎÎÊÌ⣬µ«¹Ø¼üÊÇ£¬³ÌÐòÍùÍùÒª·¢²¼µ½Óû§µÄ»úÆ÷ÉÏ£¬Èç¹ûÓû§ÓÐרÃŵķþÎñÆ÷£¬ÄÇÁíµ±±ðÂÛ£¬µ«Èç¹ûÓû§Ö»ÊÇÏëÓÃһ̨ÆÕͨ²»ÄÜÔÚÆÕͨµÄ°ì¹«»úÆ÷µ±·þÎñÆ÷µÄ»°£¬·¢²¼³ÌÐò£¬¿ÉÄܾÍÒª×öµÄÊÂÇé¶àһЩ£º
1¡¢Ê×Ïȼì²éϵͳÓÐûÓа²×°iis£¬Èç¹ûûÓУ¬ÒªÉÏÍøÏÂÔØiisµÄ°²×°°ü£¬Í¨¹ý“ ......
¼Ì³Ð"»ùÀà"¸ú¼Ì³Ð"½Ó¿Ú"¶¼ÄÜʵÏÖijЩÏàͬµÄ¹¦ÄÜ£¬µ«ÓÐЩ½Ó¿ÚÄܹ»Íê³ÉµÄ¹¦ÄÜÊÇÖ»ÓûùÀàÎÞ·¨ÊµÏÖµÄ
1.½Ó¿ÚÓÃÓÚÃèÊöÒ»×éÀàµÄ¹«¹²·½·¨/¹«¹²ÊôÐÔ. Ëü²»ÊµÏÖÈκεķ½·¨»òÊôÐÔ£¬Ö»ÊǸæË߼̳ÐËüµÄÀà
¡¶ÖÁÉÙ¡·ÒªÊµÏÖÄÄЩ¹¦ÄÜ,¼Ì³ÐËüµÄÀà¿ÉÒÔÔö¼Ó×Ô¼ºµÄ·½·¨.
2.ʹÓýӿڿÉÒÔʹ¼Ì³ÐËüµÄÀà: ÃüÃûͳһ/¹æ·¶,Ò×ÓÚά»¤.±ÈÈç: Á½ ......
·µ»Ø°´Å¥µÄʵÏÖ·½·¨£¨asp.net ÖУ©
Òý×Ô:http://blog.sina.com.cn/s/blog_49df2d0b0100aqoy.html
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔÀ´ÊäÈëµÄÊý¾Ý½øÐÐÐÞ¸ÄʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼Ó µÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.netÖж¼ÊÇÓÃÒ»¸öbuttonµÄ¿ ......
1. Web.configÖÐÌí¼Ó:
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
2. 頁ÃæÖÐÌí¼Ó:
<head>
<meta http-equiv="Content-Type" content="charset=utf-8&qu ......
asp.net×°Ôؽø¶ÈÌõ¼°¹¤×÷Ò³Ãæ¿ò¼ÜÖ÷ÒªÓÉ4¸ö²¿·Ö×é³É,Õâ4¸ö²¿·ÖµÄÃû³Æ¼°ÔÚÕû¸ö¿ò¼ÜÖÐËùÆðµ½µÄ×÷ÓÃÈçÏÂ:
1.Èë¿ÚÁ´½ÓµØÖ·Ò³Ãæ(aspx):±ÈÈç,µÇ¼ҳÃæ.Ìṩµ½Ä¿±êµØÖ·µÄÒ»¸öÁ´½Ó,²¢Ïò¸ÃÄ¿±ê´«µÝһЩÆô¶¯±ØÐëµÄ»ù±¾Á´½Ó²ÎÊý.
2.Èë¿ÚÁ´½ÓÄ¿±êÒ³Ãæ(aspx):¸ÃÄ¿±ê¶ÔÏóÊÇÕû¸ö¿ò¼ÜµÄºËÐÄ,Ò³Ãæ×°ÔØʱͨ¹ýdocument.writeÊä³ö2¸öiframe,Æä ......