asp.netÐÔÄÜ
1.¹Ø±Õ²»±ØÒªµÄSession
<%@ Page EnableSessionState="flase"%>
2.¹Ø±Õ²»±ØÒªµÄViewState
<asp:DataGrid EnableViewState="false" runat="server">
Èç¹ûÒ³Ã漶
<%@ Page EnableViewState="false"%>
3.²»ÒªÊ¹ÓÃException¿ØÖƳÌÐòÁ÷³Ì
ExceptionÊǺܺÄ×ÊÔ´µÄ
4.½ûÓÃVBºÍJScript¶¯Ì¬Êý¾ÝÀàÐÍ
¶¯Ì¬Êý¾ÝÀàÐÍÊÇÒªÕ¼ÓôóÁ¿µÄCPUÔËÐÐʱ¼ä
<%@ Page Language="VB" Strict="true"%>
5.ʹÓô洢¹ý³ÌµÄÊý¾Ý·ÃÎÊ
6.Ö»¶ÁÊý¾Ý·ÃÎʲ»ÒªÊ¹ÓÃDataSet(DataSetÊǶϿªÁ¬½ÓµÄ,´æ´¢ÔÙÄÚ´æÖÐ,ËùÒÔ×ÊÔ´µÄÏûºÄ¾Þ´ó)
ʹÓÃSqlDataReader´úÌæDataSet
SqlDataReaderÊÇread-only,forward-only
7.¹Ø±ÕASP.NETµÄDebugģʽ,²¿ÊðʱÊÇÔÙweb.configÖÐÈ¡ÏûDebug.
8.ASP.NETÊä³ö»º³å
Ò³Ã滺³å:
<% OutputCache Duration=60 VaryByParam="None"%>
Duration=ÑÓ³Ùʱ¼ä;
VaryByParam=¿Ø¼þid,ÀýÈçVaryParam="TextBox1";
Çв»¿É×÷ÎÞΪµÄ»º³å;
Ƭ¶Ï»º³å :VaryByControl
asp.netеĶÔÏóCacheÓÚApplication¶ÔÏó¾ßÓÐÏàͬµÄ×÷ÓÃÓò
Cache.Insert("MyData",Source,new CacheDependency(Server.MapPath("authors.xml")));
¾ø¶Ô¹ýÆÚ
Cache.Insert("MyData",Source,null,DataTime.Now.AddHours(1),TimeSpan.Zero);
Ïà¶Ô¹ýÆÚ
Cache.Insert("Mydata",Source,null,DataTime,MaxValue,TimeSpan.fromMinutes(20));
Ïà¹ØÎĵµ£º
µÚ4Õ ASP.NETµÄÍøÒ³´úÂëÄ£Ðͼ°ÉúÃüÖÜÆÚ
´Ó±¾Õ¿ªÊ¼£¬¾Í½øÈëÁËASP.NETÓ¦ÓóÌÐò¿ª·¢µÄÊÀ½ç¡£ÔÚÁ˽âÁËC#µÄ½á¹¹£¬ÒÔ¼°ÃæÏò¶ÔÏóµÄ¸ÅÄîºó£¬¾Í¿ÉÒÔ´ÓÃæÏò¶ÔÏóµÄ˼Ï뿪·¢ASP.NETÓ¦ÓóÌÐò¡£ÔÚASP.NETÖУ¬Äܹ»Ê¹ÓÃÃæÏò¶ÔÏóµÄ˼ÏëºÍÈí¼þ¿ª·¢ÖеÄһЩ˼Ï룬ÀýÈç·â×°¡¢ÅÉÉú¡¢¼Ì³ÐÒÔ¼°¸ß¼¶µÄÉè¼ÆģʽµÈ¡£±¾ÕÂÊ×ÏȽéÉÜASP.NETÖÐ×îÖ ......
12 ASP.NET MVC Best Practices
M
DomainModel != ViewModel
Use ActionFilters for “shared” data
V
Do NEVER user code-behind
Write HTML each time you can
If there is an if, write an HtmlHelper
Choose your view engine carefully
C
Delete the AccountController
Isolate Controllers fro ......
///<summary>
///±¸·ÝÊý¾Ý¿âµ½±¾µØ´ÅÅÌ
///</summary>
public bool BackUp(string BackUpFile)
{
try
&nbs ......
ÏÈ¿´¿´ASP.NETÒ³ÃæˢеÄʵÏÖ·½·¨£º
µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } µÚ¶þ£º
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script language=javascript>window.locatio ......