ASP.NET»º´æ
Ò³ÃæÊä³ö»º´æ×÷Ϊ×î¼òµ¥µÄ»º´æÐÎʽ£¬Êä³ö»º´æÖ»ÊÇÔÚÄÚ´æÖб£ÁôΪÏìÓ¦ÇëÇó¶ø·¢Ë굀 HTML µÄ¸±±¾¡£ÆäºóÔÙÓÐÇëÇóʱ½«Ìṩ»º´æµÄÊä³ö£¬Ö±µ½»º´æµ½ÆÚ£¬ÕâÑù£¬ÐÔÄÜÓпÉÄܵõ½ºÜ´óµÄÌá¸ß£¨È¡¾öÓÚÐèÒª¶àÉÙ¿ªÏúÀ´´´½¨ÔʼҳÃæÊä³ö - ·¢ËÍ»º´æµÄÊä³ö×ÜÊǺܿ죬²¢ÇұȽÏÎȶ¨£©¡£
ÉèÖÃÒ³ÃæÊä³ö»º´æ¿ÉÒÔʹÓÃÒÔÏÂÁ½ÖÖ·½Ê½£ºÒ»ÖÖÊÇʹÓÃ@ OutputCacheÖ¸ÁÁíÒ»ÖÖÊÇʹÓÃÒ³ÃæÊä³ö»º´æAPI¡£@ OutputCacheÖ¸ÁîÔø¾ÔÚASP.NET 1.xÖгöÏÖ¹ý£¬²¢ÔÚASP.NET 2.0Öеõ½Á˼̳кÍÔöÇ¿¡£Ò³ÃæÊä³ö»º´æAPIÖ÷ÒªÊÇÖ¸HttpCachePolicyÀà¡£
@ OutputCache ÒÔÉùÃ÷µÄ·½Ê½¿ØÖÆ ASP.NET Ò³»òÒ³Öаüº¬µÄÓû§¿Ø¼þµÄÊä³ö»º´æ²ßÂÔ¡£
Óï·¨ÈçÏÂ
<% @ OutputCache Duration = " #ofseconds "
Location = " Any | Client | Downstream | Server | None |
ServerAndClient "
Shared = " True | False "
VaryByControl = " controlname "
VaryByCustom = " browser | customstring "
VaryByHeader = " headers "
VaryByParam = " parametername "
CacheProfile = " cache profile name | '' "
NoStore = " true | false "
SqlDependency = " database/table name pair | CommandNotification "
%>
Duration Ò³»òÓû§¿Ø¼þ½øÐлº´æµÄʱ¼ä£¨ÒÔÃë¼Æ£©¡£ÔÚÒ³»òÓû§¿Ø¼þÉÏÉèÖøÃÊôÐÔΪÀ´×Ô¶ÔÏóµÄ HTTP ÏìÓ¦½¨Á¢ÁËÒ»¸ö¹ýÆÚ²ßÂÔ£¬²¢½«×Ô¶¯»º´æÒ³»òÓû§¿Ø¼þÊä³ö¡£ Location
¡¡¡¡ÓÃÓÚÖ¸¶¨Êä³ö»º´æÏîµÄλÖá£ÆäÊôÐÔÖµÊÇOutputCacheLocationö¾ÙÖµ£¬ËüÃÇÊÇAny¡¢Client¡¢Downstream¡¢None¡¢ServerºÍServerAndClient¡£Ä¬ÈÏÖµÊÇAny£¬±íʾÊä³ö»º´æ¿ÉÓÃÓÚËùÓÐÇëÇ󣬰üÀ¨¿Í»§¶Ëä¯ÀÀÆ÷¡¢´úÀí·þÎñÆ÷»ò´¦ÀíÇëÇóµÄ·þÎñÆ
Ïà¹ØÎĵµ£º
¸Õ±ÏÒµ£¬×î½üÔÚ¸ã±ÏÒµÂÛÎÄ¡£
˵Æð±ÏÒµÂÛÎÄÎÒ¾ÍÍ·ÌÛ£¬ÎÒÃÇÈýÈËÒ»×飬±¾À´ÎÒÖ÷ÕÅÓÃC#д£¬Ì×ÓÃÒ»¸öÍâ¹úµÄÄ£ÐÍBalloonShopÔÚÏß¹ºÎïÍøÕ¾£¬C#ÊÇ×ÔѧµÄ¡£µ«ÊÇͬ×éµÄÒ»¸öͬѧVBѧµÃ²»´í£¬ÒªÓÃVB¡£ÎÒÏëÄãÒªÓÃVBдµÄ»°ÎÒÊDz»Ì«¶®£¬ÄÇÖ»ÄÜÄã×Ô¼ºÐ´ºÃÁË£¬ÎÒ×î¶àÒ²¾Í´î°ÑÊÖ¶øÒÑ£¬Ê¡ÐÄÁË£¬ºÎÀÖ¶ø²»ÎªÄØ£¡
×îºó×÷Æ·×ö³öÀ´»¹Ëã²»´í£¬¾Í ......
1¡¢½¨Á¢Êý¾Ý²ã Á¬½ÓÊý¾Ý¿â->½¨Á¢Êý¾Ý¼¯*.xsd->±íÖн¨Á¢²éѯ·½·¨
2¡¢½¨Á¢ÒµÎñÂß¼²ã °ü×°TableAdapter·½·¨³ÉÀà
3¡¢½¨Á¢Ä¸°åÒ³ºÍÕ¾µãµ¼º½£¨ CSS´ýѧϰ£©
4¡¢Ê¹ÓÃÊý¾ÝÔ´Õ¹ÏÖÊý¾Ý ÎåÖÖÊý¾ÝÔ´ ±à¼Êý¾ÝÔ´²ÎÊý ʹÓÃtableadapter·½·¨
5¡¢Ê¹ÓÃdropDownList¹ýÂËÖ÷-´Ó±¨±í
ʹÓÃtableadapter·½·¨ ......
1.ʹÓÃPage.IsPostBack¼õÉÙÒ³Ãæ»Ø·¢´ÎÊý
2.±ÜÃâʹÓ÷þÎñÆ÷¿Ø¼þ£¬Èç¹ûÓõ½·þÎñÆ÷¿Ø¼þ£¬ÓÐЩ¿Ø¼þ²»ÐèҪά»¤Æä״̬£¬¿ÉÒÔÉèÖÃÆäÊôÐÔ: EnableViewState=false;
Èç¹ûÕû¸öÒ³Ãæ¿Ø¼þ¶¼²»ÐèҪά³Ö״̬ÊÓͼ£¬Ôò¿ÉÒÔÉèÖÃÕû¸öÒ³ÃæµÄ״̬ÊÓÁ¦Îªfalse:
´úÂëÈçÏÂ: <%@ Page Enable ......
ÎÊÌâ1£º
“/dsfsd”Ó¦ÓóÌÐòÖеķþÎñÆ÷´íÎó¡£
佫¶ÔÏóÒýÓÃÉèÖõ½¶ÔÏóµÄʵÀý¡£
˵Ã÷: Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£
Òì³£ÏêϸÐÅÏ¢: System.NullReferenceException: 佫¶ÔÏóÒýÓÃÉèÖõ½¶ÔÏóµÄʵÀý¡£
Ô´´íÎó:
Ö´ ......
Asp.net ºǫ́µ÷ÓÃjs·½·¨(ת)
1. ÓÃResponse.Write·½·¨
¡¡¡¡´úÂëÈçÏ£º
Response.Write("<script type='text/javascript'>alert("XXX");</script>");
´Ë·½·¨È±ÏݾÍÊDz»Äܵ÷Óýű¾ÎļþÖеÄ×Ô¶¨ÒåµÄº¯Êý£¬Ö»Äܵ÷ÓÃÄÚ²¿º¯Êý£¬¾ßÌåµ÷ÓÃ×Ô¶¨ÒåµÄº¯ÊýÖ»ÄÜÔÚResponse.WriteдÉϺ¯Êý¶¨ Ò壬±ÈÈç
Response.Write("& ......