ASP.NET 2.0ÍøÕ¾ÓÅ»¯¼¼ÇÉ×ܽá
1. µ±²»ÐèҪʹÓÃSessionµÄʱºòÇë¹Ø±Õ
¹Ø±ÕSessionµ±²»ÐèҪʹÓõÄʱºò
• ÈôÒª½ûÓÃÒ³µÄ»á»°×´Ì¬£¬Ç뽫@ Page Ö¸ÁîÖеÄEnableSessionState ÊôÐÔÉèÖÃΪfalse¡£ÀýÈ磬<%@ Page EnableSessionState="false" %>¡£
• ×¢ÒâÈç¹ûÒ³ÐèÒª·ÃÎʻỰ±äÁ¿£¬µ«²»´òËã´´½¨»òÐÞ¸ÄËüÃÇ£¬Ôò½«@ Page Ö¸ÁîÖеÄEnableSessionState ÊôÐÔÉèÖÃΪReadOnly¡£»¹¿ÉÒÔ½ûÓÃXML Web services ·½·¨µÄ»á»°×´Ì¬¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼ûʹÓÃASP.NET ºÍXML Web services ¿Í»§¶Ë´´½¨µÄXML Web services¡£
• ÈôÒª½ûÓÃÓ¦ÓóÌÐòµÄ»á»°×´Ì¬£¬ÇëÔÚÓ¦ÓóÌÐòWeb.config ÎļþµÄsessionstate ÅäÖýÚÖн«mode ÊôÐÔÉèÖÃΪoff¡£ÀýÈ磬<sessionstate mode="off" />¡£
2.¾¡Á¿Ê¹Óÿͻ§¶Ë½Å±¾
ËäÈ»ÄúºÜ¿ÉÄÜÏ£Íû¾¡Á¿¶àµØʹÓÃWeb ´°ÌåÒ³¿ò¼ÜµÄÄÇЩ½Úʡʱ¼äºÍ´úÂëµÄ¹¦ÄÜ£¬µ«ÔÚijЩÇé¿öÏÂÈ´²»ÒËʹÓÃASP.NET ·þÎñÆ÷¿Ø¼þºÍ»Ø·¢Ê¼þ´¦Àí¡£Í¨³££¬Ö»ÓÐÔÚ¼ìË÷»ò´æ´¢Êý¾Ýʱ£¬Äú²ÅÐèÒªÆô¶¯µ½·þÎñÆ÷µÄÍù·µ¹ý³Ì¡£¶àÊýÊý¾Ý²Ù×÷¿ÉÔÚÕâЩÍù·µ¹ý³Ì¼äµÄ¿Í»§¶ËÉϽøÐС£ÀýÈ磬´ÓHTML´°ÌåÑéÖ¤Óû§ÊäÈë¾³£¿ÉÔÚÊý¾ÝÌá½»µ½·þÎñÆ÷֮ǰÔÚ¿Í»§¶Ë½øÐС£Í¨³££¬Èç¹û²»ÐèÒª½«ÐÅÏ¢´«µÝµ½·þÎñÆ÷ÒÔ½«Æä´æ´¢ÔÚÊý¾Ý¿âÖУ¬ÄÇôÄú²»Ó¦¸Ã±àдµ¼ÖÂÍù·µ¹ý³ÌµÄ´úÂë¡£
3.ʹÓÃPage.IsPostback±ÜÃâ¶ÔÍù·µ¹ý³ÌÖ´Ðв»±ØÒªµÄ´¦Àí
• Èç¹ûÄú±àд´¦Àí·þÎñÆ÷¿Ø¼þ»Ø·¢´¦ÀíµÄ´úÂ룬ÓÐʱ¿ÉÄÜÐèÒªÔÚÊ×´ÎÇëÇóҳʱִÐÐÆäËû´úÂ룬¶ø²»Êǵ±Óû§·¢ËÍ°üº¬ÔÚ¸ÃÒ³ÖеÄHTML ´°ÌåʱִÐеĴúÂë¡£¸ù¾Ý¸ÃÒ³ÊÇ·ñÊÇÏìÓ¦·þÎñÆ÷¿Ø¼þʼþÉú³ÉµÄ£¬Ê¹ÓÃPage.IsPostBack ÊôÐÔÓÐÌõ¼þµØÖ´ÐдúÂë¡£
• ×¢ÒâÈç¹û²»ÔËÐÐÕâÖÖ¼ì²é£¬»Ø·¢Ò³µÄÐÐΪ½«²»¸ü¸Ä¡£Page_Load ʼþµÄ´úÂëÔÚÖ´ÐзþÎñÆ÷¿Ø¼þʼþ֮ǰִÐУ¬µ«Ö»ÓзþÎñÆ÷¿Ø¼þʼþµÄ½á¹û²Å¿ÉÄÜÔÚÊä³öÒ³ÉϳÊÏÖ¡£Èç¹û²»ÔËÐиüì²é£¬ÈÔ½«ÎªPage_Load ʼþºÍ¸ÃÒ³ÉϵÄÈκηþÎñÆ÷¿Ø¼þʼþÖ´Ðд¦Àí¡£
4.ÔÚÊʵ±µÄ»·¾³ÖÐʹÓÃASP.NET ·þÎñÆ÷¿Ø¼þ
¼ì²éÄúµÄÓ¦ÓóÌÐò´úÂëÒÔÈ·±£¶ÔASP.NET·þÎñÆ÷¿Ø¼þµÄʹÓÃÊDZØÒªµÄ¡£¼´Ê¹ËüÃǷdz£Ò×ÓÚʹÓ㬵«ÊÇ·þÎñÆ÷¿Ø¼þ²¢²»×ÜÊÇÍê³ÉÈÎÎñµÄ×î¼ÑÑ¡Ôñ£¬ÒòΪËüÃÇ»áʹÓ÷þÎñÆ÷×ÊÔ´¡£ÔÚÐí¶àÇé¿öÏ£¬Ò»¸ö¼òµ¥µÄ³ÊÏÖ»òÊý¾Ý°ó¶¨´úÈë¾Í¿ÉÒÔÍê³ÉÈÎÎñ¡£
5.Ö»ÔÚ±ØҪʱ±£´æ·þÎñÆ÷¿Ø¼þÊÓͼ״̬
• ×Ô¶¯ÊÓͼ״̬¹ÜÀíÊÇ·þÎñÆ÷¿Ø¼þµÄ¹¦ÄÜ£¬¸Ã¹¦ÄÜʹ·þÎñÆ÷
Ïà¹ØÎĵµ£º
The following is a simple checklist you can use when building web
applications. Much of this still applies to other technologies and can
easily be extended. I try not to get too specific on technology or
methodology, but it is definitely leaning toward ASP.NET.
If you
......
ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......
·½·¨Ò»¡¢ÔÚWeb.configÖÐÅäÖÃ,¾ßÌå×ö·¨Îª:ÔÚWeb.configÎļþµÄSystem.web½ÚÖÐÌí¼ÓÈçÏ´úÂë
1<pages>
2 <controls>
3 <add assembly="ServerControl" namespace="ServerControl" tagPrefix="sc"/>
4 </controls>
5</pages>
˵Ã÷£ºassembly±íʾ¿Ø¼þËùÔڵijÌÐò¼¯Ãû³Æ£¬nam ......
asp.netʵÏÖα¾²Ì¬
Ò»¡¢Î±¾²Ì¬µÄÓô¦
ÓÐЩÓû§
¾õµÃ£¬Î±¾²Ì¬ºÍÕ澲̬ʵ¼Ê±»ÊÕ¼Á¿»áÏà²îºÜ´ó£¬Æäʵ²»È»£¬´ÓÄã¸öÈ˽Ƕȣ¬Äã
È¥ÅжÏÒ»ÏÂÒ»¸öÌû×Óµ½µ×ÊÇÕ澲̬»¹ÊÇα¾²Ì¬£¿¹À¼ÆºÜÄÑ¿´µÃ³ö£¬ÒòΪËùν¾²Ì¬µÄÒâ˼£¬¾ÍÊǵØÖ·Öв»´øÎʺţ¬²»´øÎʺŵľÍÊǾ²Ì¬£¬¹ÜËûÊÇÕæµÄ»¹ÊÇαµÄ£¿ËÑË÷Òý
Çæ¿´µÃ³öÂð£¿ËùÒÔ˵£¬Æäʵ² ......
Ò»¡¢Ê²Ã´ÊÇSQL×¢Èëʽ¹¥»÷?
¡¡¡¡ËùνSQL×¢Èëʽ¹¥»÷£¬¾ÍÊǹ¥»÷Õß°ÑSQLÃüÁî²åÈëµ½Web±íµ¥µÄÊäÈëÓò»òÒ³ÃæÇëÇóµÄ²éѯ×Ö·û´®£¬ÆÛÆ·þÎñÆ÷Ö´ÐжñÒâµÄSQLÃüÁî¡£ÔÚijЩ±í
µ¥ÖУ¬Óû§ÊäÈëµÄÄÚÈÝÖ±½ÓÓÃÀ´¹¹Ôì(»òÕßÓ°Ïì)¶¯Ì¬SQLÃüÁ»ò×÷Ϊ´æ´¢¹ý³ÌµÄÊäÈë²ÎÊý£¬ÕâÀà±íµ¥ÌرðÈÝÒ×Êܵ½SQL×¢Èëʽ¹¥»÷¡£³£¼ûµÄSQL×¢Èëʽ¹¥
»÷¹ý³ÌÀàÈ磺
......