ASP. NET development experience

Source: Internet
Author: User
During the development process, we found some useful experiences through data query:

1. Compared with the previous for statement foreach, foreach has a better execution efficiency. The average time spent by foreach is only 30% of that of. When both for and foreach can be used through the test results, we recommend using a more efficient foreach. In addition, the write time using for is about 10 times the read time;

2. In Asp.netProgramUsing the SA account is very insecure. It has the permission to perform any operations on the database. Hackers can call extended stored procedures like xp_mongoshell to launch attacks;

3. When processing data interactions, try to put the processing of SQL statements in the middle layer (such as specialized data operations and stored procedures), which is an effective way to prevent injection attacks;

4. Avoid unnecessary round-trip to the server. Use Page. ispostback to avoid unnecessary operations on the round-trip process;

5. You must disable the debugging mode;

6. Generally, sqldatareader is used to read a large amount of data and not process the returned data in large quantities. datset is suitable for handling large amounts of returned data. the selection of sqldatareader and dataset depends on the implementation of program functions;

7. We recommend that you use <% # ctype (container. dataitem, datarowview). Row ("field name") %> for data binding. When the data volume is large, the speed can be increased by several hundred times;

Welcome to communicate with me! You are welcome to give your comments!

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.