ASP.NET»º´æ
½éÉÜ
»º´æÊÇÔÚÄÚ´æ´æ´¢Êý¾ÝµÄÒ»Ïî¼¼Êõ£¬Ò²ÊÇASP.NETÖÐÌṩµÄÖØÒªÌØÐÔÖ®Ò»¡£ÀýÈçÄã¿ÉÒÔÔÚ¸´ÔÓ²éѯµÄʱºò»º´æÊý¾Ý£¬ÕâÑùºóÀ´µÄÇëÇó¾Í²»ÐèÒª´ÓÊý¾Ý¿âÖÐÈ¡Êý¾Ý£¬¶øÊÇÖ±½Ó´Ó»º´æÖлñÈ¡¡£Í¨¹ýʹÓûº´æ¿ÉÒÔÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄÜ¡£
Ö÷ÒªÓÐÁ½ÖÖÀàÐ͵Ļº´æ£º
1.Êä³ö»º´æOutput caching
2.Êý¾Ý»º´æData caching
1. Êä³ö»º´æ(Output Caching)
ʹÓÃÊä³ö»º´æ£¬Äã¿ÉÒÔ»º´æ×îºóÊä³öµÄHTMLÒ³Ã棬µ±ÏàͬµÄÒ³ÃæÔÙ´ÎÇëÇóµÄʱºò£¬ASP.NET²»»áÔÙÖ´ÐÐÒ³ÃæµÄÉúÃüÖÜÆÚºÍÏà¹Ø´úÂë¶øÊÇÖ±½ÓʹÓûº´æµÄÒ³Ã棬Óï·¨ÈçÏ£º
<%@ OutputCache Duration=”60” VaryByParam=”None” %>
Duration ÊôÐÔÉèÖÃÒ³Ã潫±»»º´æ60Ãî¡£ÈκεÄÓû§ÇëÇ󶼻ᱻ»º´æ£¬ÔÚ»º³åµÄ60ÃëÄÚÏàͬµÄÇëÇ󶼻áÖ±½ÓʹÓûº´æµÄÒ³Ãæ¡£µ±»º´æ¹ýÆÚºóASP.NET»áÔÙ´ÎÖ´ÐÐÒ³Ãæ´úÂë²¢ÇÒΪÏÂÒ»¸ö60Ãë´´½¨Ò»¸öеÄHTML»º´æ¡£
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="OutputCachingTest.aspx.cs" Inherits="OutputCachingTest" Title="Untitled Page" %>
<%@ OutputCache Duration="20" VaryByParam="None" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="title">Output Cache</div>
Date: <asp:Label ID="lblDate" runat="server" Text="" />
Time: <asp:Label ID="lblTime" runat="server" Text="" />
</asp:Content>
protected void Page_Load(object sender, EventArgs e)
{
lblDate.Text = DateTime.Now.ToShortDateString();
lblTime.Text = DateTime.Now.ToLongTimeString();
}
ÔÚÕâ¸öÀý×ÓÖÐÒ³Ã潫±»»º´æ20Ãë¡£
ͨ¹ý²éѯ×Ö·û´®»º´æ(Cache by Query String )
ÔÚʵ¼ÊÓ¦ÓÃÖÐÒ³ÃæÍùÍù»á¸ù¾ÝһЩ²ÎÊý¶¯Ì¬µÄ¸Ä±äÒ³ÃæµÄÄÚÈÝ¡£Èç¹ûÄãµÄÒ³ÃæÊÇͨ¹ý²éѯ×Ö·û´®À´»ñÈ¡ÐÅÏ¢µÄ£¬Äã¿ÉÒÔ¸ù¾Ý²éѯ×Ö·û´®ºÜÈÝÒ׵Ļº´æÒ³ÃæµÄ²»Í¬¿½±´¡£VarByParam=”None”Ö¸¶¨ASP.NETÖ»´æ´¢»º´æÒ³ÃæµÄÒ»¸ö¿½±´¡£VarByParam=”*” Ö¸¶¨ASP.NET¸ù¾Ý²»Í¬µÄ²éѯ×Ö·û´®´æ´¢²»Í¬µÄ»º´æÒ³Ãæ¡£
<%@ OutputCache Duration="60" VaryByParam="*" %>
<div align="right">
<a href="OutputCachingTest2.aspx">No Query String</a> |
<
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
¼ÙÉèÔÚ·þÎñÆ÷µÄ¸ùĿ¼ÏÂÓиöÃûΪDownloadµÄÎļþ¼Ð,Õâ¸öÎļþ¼Ð´æ·ÅһЩÌṩ¸øÒýÓóÌÐòÏÂÔصÄÎļþ..
public void DownloadFile(string path, string name)
{
try
{
......
´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.netÒ³ÃæÖеÄij¸öButton±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcEl ......
¡¡¡¡×Ô´ÓÉÏ´ÎÓÐÁËÒ»´ÎÆƽâÑéÖ¤ÂëµÄ¾Ñéºó£¬¾ÍÒ»Ö±Ïë×Ô¼ºÐ´¸öÏñÑùµãµÄÑéÖ¤Âë¡£½ñÌìÎÞÁÄËùÒÔ¾ÍдÁË£¬×ÜÌåÉÏÀ´Ëµ»¹ËãºÜÂúÒâ¡£¾ÍÊÇÓÐʱ¸´ÔÓµÃÈâÑÛ¶¼¿´²»³öÊÇɶ£¨ÕâÒ²¸úͼƬ̫СÓйØϵ£©¡£
¡¡¡¡Õâ¸öÑéÖ¤ÂëÖ§³ÖËæ»ú×ÖÌå¡¢×ÖÌå´óС¡¢×ÖÌåÑùʽ£¨ÆÕͨ¡¢´ÖÌ塢бÌ壩¡¢×ÖÌåÑÕÉ«¡¢×Ô¶¨Òå×Ö·ûµÈ¡£
¡¡¡¡´úÂëÖеÄlibFontÊÇ×ÖÌå¿â£¬libC ......