1. disable unnecessary sessions
<% @ Page enablesessionstate = "flase" %>
2. disable unnecessary viewstate
<Asp: DataGrid enableviewstate = "false" runat = "server">
If
<% @ Page enableviewstate = "false" %>
3. Do not use exception to control program processes
Exception is resource-consuming.
4. Disable VB and JScript Dynamic Data Types
The dynamic data type occupies a large amount of CPU running time.
<% @ Page Language = "VB" strict = "true" %>
5. Access Data Using Stored Procedures
6. Do not use dataset for read-only data access (Dataset is disconnected and stored in memory, so the resource consumption is huge)
Use sqldatareader instead of Dataset
Sqldatareader is read-only, forward-only
7. Disable the debug mode of ASP. NET and cancel the debug mode in Web. config during deployment.
8. ASP. NET output buffer
Page buffering:
<% Outputcache duration = 60 varybyparam = "NONE" %>
Duration = delay time;
Varybyparam = Control ID, for example, varyparam = "textbox1 ";
Do not provide an inaction buffer;
Fragment Buffer: varybycontrol
Asp.net new object cache has the same scope for the Application Object
Cache. insert ("mydata", source, new cachedependency (server. mappath ("authors. xml ")));
Absolutely expired
Cache. insert ("mydata", source, null, datatime. Now. addhours (1), timespan. Zero );
Relatively expired
Cache. insert ("mydata", source, null, datatime, maxvalue, timespan. fromminutes (20 ));