ASP. NET Website Performance Optimization

Source: Internet
Author: User

If you have worked on an ASP Website and an ASP. NET WebsiteProgramPersonnel, you may find that if you develop ASP according to the normal idea. net website, Asp. the speed of the Net website is much slower than that of the ASP Website. Why is the powerful website language slower? The reason is very simple. It is because of its powerful nature that many programs need to be executed, the server is the same, so it must be ASP.. Net websites are slower than ASP websites.

Based on years of website construction experience, we will teach you how to quickly improve ASP. NET Website performance:

1. Disable viewstate. viewstate can only remember the page state when the page is sent back, breaking the inherent Stateless web, but it will definitely cause performance degradation. If this is not necessary, do not use it. For more information, see web. add enableviewstate = "false" at the beginning of config or page ";

2. Disable sessionstate. You may ask, if sessionstate is disabled, it is not impossible to use session. How to perform authentication? In fact, besides session, you can also use cookie, if you are afraid of being insecure, you can encrypt the cookie. For example, window form authentication is the built-in authentication method of Asp.net. As follows:

Authentication mode = "  Forms  " > <Forms name = "  River_form " Loginurl = "  ~ /Login. aspx  " Defaulturl = "  ~ /Default. aspx  " Protection = "  All  " Timeout = "  120000  " Path = "  /  " Requiressl = "  False  " Slidingexpiration = "  True  " Enablecrossappredirects = "  False  " Cookieless = "  Usedeviceprofile  " /> </Authentication>

 

3. Disable debugging when the website is released. Set <compilation DEBUG = "false"> in the web. config file;

4. compile and publish the website;

5. Use ASP. NET page cache and inter-control cache to improve performance;

6. Use the cache to save frequently-used data, that is, the data cache;

7. generate static pages, or generate static files for frequently used content.

8. If the data volume is large, do not use the built-in paging functions such as gridview. They read all the data and then pagination. The paging method should be used to read the data.

9. Using Stored procedures not only saves website traffic, but also increases speed and security;

10. Pay attention to ispostback. Do not re-execute some operations every time the page is sent back.

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.