Several points to improve the performance of ASP.net

Source: Internet
Author: User

Several points to improve the performance of ASP.net

Http://blog.csdn.net/metababy

Apply SQL Data Reader

The SQL data reader class retrieves data only once during the entire run, so applying the SqlDataReader class to replace the DataSet, DataTable, and so on if the conditions allow can give your application a higher performance.

Use stored procedures as much as possible instead of command statements, because stored procedures are executed after compilation, which can improve database processing speed.

Use SqlDataSource's related attributes to replace SQL conditional statements that include where or order by, taking full advantage of SqlDataSource related attributes such as: caching, filtering and sorting). You can set the SqlDataSource object's "enablecaching" property to "True" to activate caching the retrieved data in this datasource, and when you activate the cache, The SqlDataSource object performs such as filtering and sorting on the cached data that is retrieved.

You can filter and sort data by applying the FilterExpression and SortParameterName two properties of the SqlDataSource object. This will definitely improve the performance of your site.

When you use server controls such as GridView or DetailsView, you may pass the GridView or DetailsView to filter the data and set its paging property to true, a distribution called the UI distribution. To do this, the GridView control requests to obtain a special data source from which to get all the records required by the current page and ignore other data. In each page the person needs to perform such an operation, which of course causes a huge waste of resources.

There is also a technology to achieve this function, called data source paging technology. Implemented using the DataSource control, DataSourceView is the process class that sets its AllowPaging property to True when the GridView or DetailsView is applied to this data source. This allows the data source to take only the current page's data.

Focus on this piece of data, and others such as: Session viewstate cache, and so on. As this kind of article is more, it is not stated.

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.