Analysis on ASP. NET technique to improve application performance

Source: Internet
Author: User

◆ ASP. NET skills to improve ASP. NET application performance: Even if you do not use Visual Studio. NET for programming, using code support files will also help improve the application performance

How can I improve the performance of ASP. NET applications? Visual Studio. NET uses code support files in all ASP. NET Web projects such as Web applications, Web Services, and Web controls. Code support files make the project better organized and coherent, and more suitable for development teams composed of multiple people. It also improves the performance.

The content of the Code support file is compiled into a class in the composite file, which is generally a DLL file and sometimes an EXE file. The file resides in the high-speed buffer of the application assembly, and can be obtained immediately when the application starts.

If the code is contained in the <SCRIPT> mark or the ASPX file code, it will still be compiled into a webpage class. In this case, every time the web page is loaded for the first time in the application conversation, it needs to be re-compiled, and the compiled class will reside in the memory. This file must be re-compiled whenever the computer is started, IIS is stopped, restarted, or the source code or configuration file is changed. Although not big, this causes considerable performance loss.

◆ ASP. NET tips to improve ASP. NET application performance: Minimize form delivery

Every time you click the Button, LinkButton, or ImageButton control on a Web page, the form is sent to the server. If the AutoPostBack attribute of the control is set to true, if the status of the control such as CheckBox and CheckBoxList is changed, the form will be sent back to the server.

Each time a form is sent back to the server, it is reloaded, The Page_Load event is started, and all code in the Page_Load event processing program is executed. It is most appropriate to put the webpage initialization code here. We often want to execute some code each time a webpage is loaded, but we want to execute other code only when the webpage is loaded for the first time, I even want some code to be executed each time except for the first loading.

You can use the IsPostBack feature to complete this function. When a webpage is loaded for the first time, the value of this attribute is false. If the webpage is reloaded due to sending back, the value of the IsPostBack attribute is set to true. Through testing, you can execute the Specified Code at any time. The following is the relevant C # code:

 
 
  1. Protected VoidPage_Load (Object sender, EventArgs e)
  2. {
  3. // Operations performed each time a webpage is loaded 
  4. If(! IsPostBack)
  5. {
  6. // The operation performed when the page is loaded for the first time 
  7. }
  8. Else
  9. {
  10. // The operation performed during the delivery. 
  11. }
  12.  
  13. // Operations performed when a webpage is loaded 
  14. }

We hope that the server will be required to perform a series of operations if possible, even if it causes a return. We also hope to perform as few operations as possible. Large-scale, time-wasting operations, such as database searches, should be avoided in particular because they can prolong the application response time.

To improve the performance of ASP. NET applications, we will introduce you here, and hope to help you.

  1. Analysis of ASP. NET database connection instances
  2. Analysis on ASP. NET database connection pool settings
  3. How to Learn the nine steps of ASP. NET
  4. Analysis of data collection procedures using ASP. NET Techniques
  5. ASP. NET naming settings

Related Article

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.