ASP.NET Cache
1. INTRODUCTION
´óÁ¿µÄÍøÕ¾Ò³ÃæÊDzÉÓö¯Ì¬µÄ·½Ê½£¬¸ù¾ÝÓû§Ìá½»µÄ²»Í¬ÇëÇó´´½¨Éú³ÉÒ³Ãæ¡£ÕýÈçÎÒÃÇËùÖªµÄ£¬¶¯Ì¬Ò³ÃæÓÐÖúÓÚ¸ù
¾ÝÓû§ÒªÇóÀ´Ìṩ¶¨ÖƵĶ¯Ì¬ÄÚÈÝ¡£¶¯Ì¬Ò³ÃæÒ²ÀûÓÚ»ñÈ¡ÔÚÊý¾Ý¿âÖÐÿʱÿ¿Ì¸üеÄ×ÊÁÏ¡£È±µãÊÇΪÿ¸öÓû§ÇëÇóÉú³ÉͬһҳÃæÔö¼ÓÁËϵͳ¿ªÏú¡£
ASP.NET
ÌṩÁË»º´æ¼¼ÊõÓÐÖúÓÚÎÒÃÇ×î´ó³Ì¶ÈµØ½â¾öÕâ¸öÎÊÌâ¡£ËüÄÜ»º´æÊä³öµÄÒ³Ã棬±£´æÔÚ´æ´¢Æ÷µ±ÖУ¬»º´æÓû§ÇëÇóµÄÄÚÈÝ¡£»º´æµÄÌصã¿ÉÒÔ¸ù¾Ý²»Í¬·½Ê½À´¶¨ÖƵġ£
±¾ÎÄÖ÷Òª½éÉÜASP.NETµÄ»º´æ¼¼Êõ¡£½éÉÜÆäʹÓ÷½·¨£¬ÒÔ¼°¿Í»§¶Ë»º´æ´æÔÚµÄÎÊÌâ¡£
2. ASP.NET CACHE
ȼ
´æÊÇ°ÑÓ¦ÓóÌÐòÖÐÐèҪƵ·±¡¢¿ìËÙ·ÃÎʵÄÊý¾Ý±£´æÔÚÄÚ´æÖеıà³Ì¼¼Êõ¡£ASP.NETÌṩÈýÖÖÖ÷ÒªÐÎʽµÄ»º´æ£ºÒ³Ã漶Êä³ö»º´æ¡¢Óû§¿Ø¼þ¼¶Êä³ö»º´æ£¨»ò³ÆΪ
Ƭ¶Î»º´æ£©ºÍ»º´æAPI¡£Êä³ö»º´æºÍƬ¶Î»º´æµÄÓŵãÊǷdz£Ò×ÓÚʵÏÖ£¬ÔÚ´ó¶àÊýÇé¿öÏ£¬Ê¹ÓÃÕâÁ½ÖÖ»º´æ¾Í×ã¹»ÁË¡£¶ø»º´æAPIÔòÌṩÁ˶îÍâµÄÁé»îÐÔ£¨Êµ¼ÊÉÏ
ÊÇÏ൱´óµÄÁé»îÐÔ£©£¬¿ÉÓÃÓÚÔÚÓ¦ÓóÌÐòµÄÿһ²ãÀûÓûº´æ¡£±¾ÎÄÖ»½éÉÜÒ³Ã漶»º´æºÍÓû§¿Ø¼þ¼¶»º´æ¡£
2.1. Page Caching
×÷
Ϊ×î¼òµ¥µÄ»º´æÐÎʽ£¬Êä³ö»º´æÖ»ÊÇÔÚÄÚ´æÖб£ÁôΪÏìÓ¦ÇëÇó¶ø·¢Ë굀 HTML
µÄ¸±±¾¡£ÆäºóÔÙÓÐÇëÇóʱ½«Ìṩ»º´æµÄÊä³ö£¬Ö±µ½»º´æµ½ÆÚ£¬ÕâÑù£¬ÐÔÄÜÓпÉÄܵõ½ºÜ´óµÄÌá¸ß£¨È¡¾öÓÚÐèÒª¶àÉÙ¿ªÏúÀ´´´½¨ÔʼҳÃæÊä³ö -
·¢ËÍ»º´æµÄÊä³ö×ÜÊǺܿ죬²¢ÇұȽÏÎȶ¨£©¡£
ҪʵÏÖÒ³ÃæÊä³ö»º´æ£¬Ö»Òª½«Ò»Ìõ OutputCache Ö¸ÁîÌí¼Óµ½Ò³Ãæ¼´¿É£º
£¼%@
OutputCache Duration="60" VaryByParam="*" %£¾
ÈçͬÆäËûÒ³ÃæÖ¸ÁîÒ»Ñù£¬¸ÃÖ¸ÁîÓ¦¸Ã³öÏÖÔÚ
ASPXÒ³ÃæµÄ¶¥²¿£¬¼´ÔÚÈκÎÊä³ö֮ǰ¡£ËüÖ§³ÖÎå¸öÊôÐÔ£¨»ò²ÎÊý£©£¬ÆäÖÐÁ½¸öÊDZØÐèµÄ¡£
Duration£º±ØÐèÊôÐÔ¡£Ò³ÃæÓ¦¸Ã±»»º´æµÄʱ¼ä£¬ÒÔÃëΪµ¥Î»¡£±ØÐëÊÇÕýÕûÊý¡£
Location£ºÖ¸¶¨Ó¦¸Ã¶ÔÊä³ö½øÐлº´æµÄλÖá£Èç¹ûÒªÖ¸¶¨¸Ã²ÎÊý£¬Ôò±ØÐëÊÇÏÂÁÐÑ¡ÏîÖ®Ò»£ºAny¡¢Client¡¢Downstream¡¢None¡¢
Server »ò ServerAndClient¡£
VaryByParam£º±ØÐèÊôÐÔ¡£Request
ÖбäÁ¿µÄÃû³Æ£¬ÕâЩ±äÁ¿ÃûÓ¦¸Ã²úÉúµ¥¶ÀµÄ»º´æÌõÄ¿¡£"none" ±íʾûÓб䶯¡£"*" ¿ÉÓÃÓÚΪÿ¸ö²»Í¬µÄ±äÁ¿Êý×é´´½¨ÐµĻº´æÌõÄ¿¡£±äÁ¿Ö®¼äÓÃ
";&q
Ïà¹ØÎĵµ£º
Asp.netµÄÉí·ÝÑéÖ¤ÓÐÓÐÈýÖÖ£¬·Ö±ðÊÇ"Windows | Forms | Passport"£¬ÆäÖÐÓÖÒÔFormsÑéÖ¤ÓõÄ×î¶à£¬Ò²×îÁé»î¡£
Forms ÑéÖ¤·½Ê½¶Ô»ùÓÚÓû§µÄÑéÖ¤ÊÚȨÌṩÁ˺ܺõÄÖ§³Ö£¬¿ÉÒÔͨ¹ýÒ»¸öµÇ¼ҳÃæÑéÖ¤Óû§µÄÉí·Ý£¬½«´ËÓû§µÄÉí·Ý·¢»Øµ½¿Í»§¶ËµÄCookie£¬Ö®ºó´ËÓû§ÔÙ·ÃÎÊÕâ¸öwebÓ¦ÓþͻáÁ¬Í¬Õâ¸öÉí·ÝCookieÒ»Æð·¢Ë͵½·þÎñ¶Ë¡£·þÎñ¶ËÉ ......
ÈçºÎÔËÓà Form ±íµ¥ÈÏÖ¤
ASP.NET µÄ°²È«ÈÏÖ¤£¬¹²ÓГWindows”“Form”“Passport”“None”ËÄÖÖÑé֤ģʽ¡£“Windows”Óë“None”ûÓÐÆðµ½±£»¤µÄ×÷Ó㬲»ÍƼöʹÓ㻓Passport”ÎÒÓÖûÓùý£¬°¦……ËùÒÔÎÒÖ»ºÃ½²½²“Form”ÈÏ ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
ASP.NETÈçºÎÁ¬½ÓAccess»òSQL ServerÊý¾Ý¿â
Ê×ÏÈ¿´Ò»¸öÀý×Ó´úÂëƬ¶Ï:
³ÌÐò´úÂë:
--------------------------------------------------------------------------------
using System.Data;
using System.Data.OleDb;
......
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+ ......
½ñÌìÔÚ×öÒ»¸öÎÞË¢ÐÂÅжϹ«Ë¾Ãû³Æ£¬ÊÇ·ñÖظ´µÄʱºò£¬·¢ÏÖÒ»¸öÎÊÌâ¾ÍÊÇͨ¹ýjavascript´«µ½asp.netÒ³ÃæµÄÖµÊÇÂÒÂë¡£ÒÔǰûÓз¢ÏÖ¡£ÒòΪ ÒÔÇ°×ö²âÊÔʱ£¬¶¼ÊÇÓÃÓ¢ÎÄ×Ö·û½øÐеIJâÊÔ¡£½ñÌìÊäÈ뺺×ֺ󣬷¢ÏÖÓÐÕâÖÖÎÊÌâ¡£¸Ð¾õ¿ÉÄÜÊDZàÂëµÄÎÊÌâ¡£¾ÍÉÏÍø²éÁËһϡ£ÕÒµ½Ò»Ð©·½·¨£¬ÈçÏ£º
1.ÉèÖÃweb.configÎļþ
<system.web>
&l ......