Asp.net Performance

Source: Internet
Author: User

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 ));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.