Analysis on the performance of ASP.net

Source: Internet
Author: User
Tags execution server memory

This course was meant to be shared with the group's brothers. Because the relationship of time has not been fulfilled, today on the Internet and everyone to study together. Please point out the wrong place.

1. ViewState

ViewState is an attribute in asp.net that is used to save a state value for a generated page in a hidden field. When the page is uploaded back to the server, the server resolves, validates, and applies the data in ViewState to restore the page's control tree. ViewState is a very useful feature that can persist the state of a client without using cookies or server memory. Most server controls use ViewState to persist the state values of those elements that interact with the user in the page. • The use of ViewState will bring some negative effects. First, it enlarges the server's response and requests the time. Second, the time to serialize and deserialize data is increased for each postback. Finally, it consumes more memory from the server. • Closes the viewstate of the specified page;

You can disable viewstate for the entire web by webconfig

<configration>
<system.web>
<pages enableviewstate= "false"/>
</system.web>
</configuration>

ViewState is encoded using BASE64 encoding.

The enableViewStateMac property indicates:

True if the asp.net should run the message authentication Code (MAC) on the page's view state when the page is postback from the client, otherwise false. The default is False. • The view state MAC is the encrypted version of the hidden variable that the page's view state is saved to when it is sent to the browser. If true, checks the encrypted view state to verify that the view state has not been tampered with on the client. Do not set enableViewStateMac to true if the primary consideration is performance. If the page view is tampered with, these states are no longer used to restore the page.

2. Performance in page jump

The requested procedure:

1 browser aspx file request---> Server execution---> encounter response.redirect statement-> server send Response.Redirect address to client side browser---> Browser requests to execute a new address

2 browser aspx file request-> Server execution-> encounter Server.Transfer statement-> server to new file

You can see Server.Transfer less than Response.Redirect the process of sending back the server and requesting the client again.

Jump object:

1 Response.Redirect can switch to any existing Web page.

2) Server.Transfer can only switch to the same directory or subdirectory of the Web page.

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.