"Go" Server.Transfer page Steering and Response.Redirect page steering differences

Source: Internet
Author: User

/* Summarize yourself */

Response.Redirect can be moved to local and external pages

SERVER.TRANSFE can only be turned to local page

/* Original abstract */

Response is to call the browser to re-turn to the specified Web page, and server naturally occurs on the server side of the main, so there will be the following differences:

1. Server.Transfer can only jump to the page specified in the local virtual directory, while the Response.Redirect is very flexible;
2. Server.Transfer can easily transfer the page parameters to the specified page;
3. When using, Server.Transfer jumps to other pages, the browser display address will not change, sometimes it will cause misunderstanding, of course, some occasions need such effect;
4. Server.Transfer can reduce client requests to the server



Server.Transfer can only be a specific page, you cannot add a URL parameter. However, the in-page variables can remain passed.




The status of the Server.Transfer jump page is similar to Response.Redirect. But there are some differences between them.

First, migrating to another page with Server.Transfer maintains the service resources. Instead of simply notifying the browser that the server has changed pages and migrated the request. This means that you don't need to carry more HTTP requests, so you can reduce the pressure on the service side and make your app run faster.

However, note that because the "Transfer" process is only available on sites that are on the same server, you cannot use Server.Transfer to jump to an external site. Only Response.Redirect can do this.

Second, Server.Transfer maintains the browser's original URL, which is for streamlined data entry technology, although it may lead to data confusion when debugging

Also, the Server.Transfer method has an overloaded method of two parameters-"Preserveform" if you set it to True (by default, false), using a state such as: Server.Transfer (" Webform2.aspx ", True), the existing request string and all the variables in the form will be persisted and submitted to your target page.

However, it is important to note that there is a strange bug here (why Microsoft has such a bug). It is possible to generate an error when you attempt to migrate a form and a request string using an overloaded method of two parameters.

The unofficial solution is to set the enableViewStateMac property of the screen that will be redirected to True, and then set back to False.

"Go" Server.Transfer page Steering and Response.Redirect page steering differences

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.