28 Tips to improve ASP performance and appearance (22-28)

Source: Internet
Author: User
Tags servervariables
Tip 22: Use Server.Transfer instead of Response.Redirect whenever possible
Tip 23: Use the back slash in the directory URL
Tip 24: Avoid using server variables
Tip 25: Upgrade to the latest and most outstanding
Tip 26: Optimize your WEB server
Tip 27: Perform a performance test
Tip 28: Read Resource Links
Tip 22: Use Server.Transfer instead of Response.Redirect whenever possible
Response.Redirect let the browser request another page. This function is often used to redirect users to a login or error page. Because redirection forces a new page to be requested, the result is that the browser must travel two times to the Web server, and the Web server must handle one more request. IIS 5.0 introduces a new function Server.Transfer that transfers execution to another ASP page on the same server. This avoids the extra browser-web-the server, which improves overall system performance and shortens user response times. Check the "New direction" in redirect, which should be Server.Transfer and Server.Execute.
See also leveraging ASP in IIS 5.0 for a complete list of the new features of IIS 5.0 and ASP 3.0.
Tip 23: Use the back slash in the directory URL
A related trick is to make sure that the backslash (/) is used in the URL that points to the directory. If you omit the backslash, the browser makes a request to the server, just to tell the server that it is requesting the directory. The browser issues a second request, which appends the slash to the URL, after which the server can respond with the default document or directory list for that directory (if there is no default document and directory browsing enabled). Additional slashes will save the first and useless live returns. To make it easier for users to read, you can omit the back slash in the display name.
For example, write:
<a href=?http://msdn.microsoft.com/workshop/? Title=? MSDN Web
This also applies to URLs that point to the home page on the Web site: using the following: <a Href=?http://msdn.microsoft.com/?&gt, instead of using <a href=?http://msdn.microsoft.com?>.
Tip 24: Avoid using server variables
Accessing a server variable causes the WEB site to send a special request to the server and collect all the server variables, not just the one you requested. This is similar to looking up a file in a moldy attic, in a folder. When you want to find the file, you must go to the attic and find the folder before you can find the file. When you request a server variable, the same happens-the first time you request a server variable, the performance is affected. Subsequent requests for other server variables do not have an impact on performance.
Never access an unqualified request object (for example, request ("Data"). For items that are not in Request.Cookies, Request.Form, Request.QueryString, or request.clientcertificate, an implicit invocation of the Request.ServerVariables. The Request.ServerVariables collection is much slower than the other collections.
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.