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.