ASP.NET development experience accumulation

xiaoxiao2021-03-06  45

During the development process, through the search information, some experiences worth mentioning: (Select from Ohiolee's blog)

a) Compared with the original For statement Foreach has better execution efficiency, Foreach is only 30% of Forth. With the test results in FOR and Foreach, we recommend more efficient Foreach. In addition, it is approximately 10 times that of the read data time;

b) In the ASP.NET program, using the SA account is a very unsafe approach, which has permission to perform any operations on the database. Hackers can invoke an extended stored procedure like XP_CMDSHELL to attack;

c) When processing data interaction, try to put the processing of the organization SQL statement into the intermediate layer (such as a dedicated data operation class, stored procedure, etc.), which is an effective way to prevent injection attacks;

d) Avoid unnecessary round-trip processes of the server. Use Page.isPostback to avoid unnecessary processing on the round-trip process;

e) Be sure to disable debug mode;

f) Under normal circumstances, read a lot of data, do not do a large number of SQLDataReader for returning data. For returning data, a large number of DATSETs are appropriate. The choice of SqlDataReader and DataSet depends on the implementation of the program function;

g) The data binding is recommended to use <% # ctype (contactView) .Row ("Field Name")%>. When the amount of data is large, it can increase the speed of several hundred times;

转载请注明原文地址:https://www.9cbs.com/read-59898.html

New Post(0)