C # How to Develop websites to improve performance

Source: Internet
Author: User

Performance improvement skills

Avoid unnecessary operations


Disable unnecessary Session Status
<% @ Page enablesessionstate = "false" %>
Use Server Control
You do not need to use server control if necessary.
You can disable viewstate if not necessary.
<Asp: DataGrid enableviewstate = "false" runat = "server"/>
<% @ Page enableviewstate = "false" %>
Do not use Exception ControlProgramProcess
Try {
Result = 100/num;
}
Catch (exception e ){
Result = 0;
}
If (num! = 0)
Result = 100/num;
Else
Result = 0;
DisableVB and JScript Dynamic Data Types
<% @ Page Language = "VB" strict = "true" %>
Access using Stored Procedure data
Do not use dataset for read-only data access
Use sqldatareader instead of Dataset
Sqldatareader is read-only, forward-only
Disable ASP. NET debug mode
Use ASP. net output cache to buffer data
Page Buffering
< % @ Outputcache % >
Duration
Varybyparam
Fragment Buffer
Varybycontrol
Data Buffer
Expiration dependency Condition
Cache. insert ("mydata", source, new cachedependency (server. mappath ("authors. xml ")));
Cache. insert ("mydata", source, null, datetime. Now. addhours (1), timespan. Zero );
Cache. insert ("mydata", source, null, datetime. maxvalue, timespan. fromminutes (20 ));
Stored procedure.
The best static page
Global cache should be well prepared
Do not include too many files
Effects implemented using JS are implemented using Js.
Can be implemented on the client.
The stored procedure is used by PAGE, and other stored procedures are used as much as possible.
Use less resource-consuming controls to reduce sending back
Remember to destroy the database connection
Instead of placing all the content in a large table, we try to use horizontal segmentation as a table.
If you can use HTML, do not use Aspx.
Do not use CS if Javascript is used.
DataGrid is not needed
Session, viewstate, and Server Control
Stored Procedures and caches will be used and will not be learned
Read-only data usage Datareader, many database operations use stored procedures,
Use < % @ Outputcache Duration = 60 varybyparam = "*" %> Cache
Disable debug mode
Correct Indexing
If (! Page. ispostback ).Code
Picture should not be too accurate
You can use aspx to dynamically generate HTML pages when there are many homepage data queries but not frequently used updates.
Controls that do not require frequent programming, such as input controls, all use HTML controls.
Use Squid Cache Technology

Considerations for implementing Asp.net for large portal websites
 

1. Do not use server-side controls
2. Disable some page-level new features of Asp.net.
3. the debug value in Web. config must be false, and the DLL file compilation must be generated as the release version.
4. Try not to use dataset. Unless nested loops are used
5. Run on win2003 Enterprise Edition.
6. Use sqlclient or oracleclient to access the databaseThese areWhen developing large websites in Asp.net, you must pay attention to some other issues, such as static pages and hardware.

Supplement:

1. Switch to server. Transfer without response. Direct
2. Do not open or create an ADO object during one usage. Try to use a connection, command, or datareader. Remember to close or release the ADO object immediately when you no longer call the database data.
3. How many data sets are used to avoid non-pagination of fields

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.