[Original] cs + html + js + css mode (1): first recognized New Mode

Source: Internet
Author: User

  

 

Reasons for modification and description

 

1. Modify the Aspx page to an HTML page:

 

Cause: the request to the HTML page is shorter than the Aspx page. The page content can be presented to the user in the shortest time.

Principle: No need for Asp.net to create page class instances for HTML pages, nor to experience the lifecycle of the Aspx page. Asp.net only needs to read the requested HTML file and send the HTML text back to the client to complete the current request.

 

2. Load the JS file after loading the HTML page:

 

Cause: there is usually a lot of JS Code on pages with complex page control or user interaction. Using the <script> label to reference a large number of JS files on the page will affect the page rendering speed.

Principle: The page is parsed from top to bottom. When you use the <script> tag to reference a JS file on the page, a request for JS is sent to the server at the same time as an HTML page request. The number of connections simultaneously initiated by IE cannot exceed 2. Requests with more than 2 connections will always wait for available connections. Therefore, HTML page loading can be completed only after almost all JS loads are completed. If the server only returns HTML content when requesting the page, the page can be displayed to the user in the shortest time. After the client page is loaded, you can use the response time of the customer to send a request to the server to retrieve the JS file.

 

3. Only data is returned from the server, rather than the page generated by Asp.net. Both Page Control and Data Display are completed by the client's JS:

 

Cause: Only data returned from the server segment can reduce the processing time on the server and the amount of data transmitted from the server to the client.

Principle: The Aspx page will go through a long life cycle and be completed within this cycle, including ViewState, business processing, data organization, and HTML code generation, this takes a certain amount of processing time, and all this is done on the server side. During this processing period, the client can only wait for the response from the server. In addition, after the Aspx page is processed by Asp.net, the HTML code and bound display data of the entire page are generated. Compared to returning data only from the server, this will undoubtedly increase the amount of data transmitted, resulting in an increase in transmission time, and eventually allow users to wait for a longer time.

 

4. Use an asynchronous request to directly request the method provided by the server Facade and update the local page through JS:

 

Cause: the direct request server method reduces the server processing time compared to the request page.

Principle: HTML pages do not accept POST requests. If the Post is directly sent from the Aspx page, the whole page will be sent back to the server. The Service is also processed on the server. Asp.net processes the lifecycle, status maintenance, page class, and control class creation and destruction of the page, and concurrently processes the HTML and data. Directly request the server Facade method. Only the service is processed and data is returned. The page only uses JS to partially update the returned data.

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.