1. server. Transfer
This API transfers the control of processing from one page to another. The information stored by the internal control (such as request and session) of the transfer project remains unchanged. Therefore, you can jump from page a to page B without losing the information on page.
2. response. Redirect
Send an HTTP Response to the client browser, telling the client which page to jump to, and the client sends a jump request to the server. Using this method, the data of the internal control cannot be saved. Page a jumps to page B, and page B cannot access the data submitted by form in.
The comparison is as follows:
Server. Transfer redirects the user to another page using the server method, response. Redirect redirects the user from the browser to another page,
The advantage of server. transfer is to pass the page parameters to the specified page. The server only transmits the context to another page. You can share the upstream and downstream information between pages without using a large number of HTTP requests temporarily. This reduces the number of requests sent from the client to the server, reduces the pressure on the server, and enables your server to run faster, response. redirect requires an additional round-trip process, which affects performance.
After server. Transfer jumps to the page, the URL address displayed by the browser does not change, and the user's browser does not know that the URL is being transferred. Therefore, historical records are not updated. If the user renews the page, unexpected results are generated.
Note that server. Transfer can only be accessed from the same site on the same server. It cannot be redirected to. asp or. asmx pages. Only response. Redirect can be used.
When programming, we try to use server. transfer when redirecting inside the website system, and response. Redirect can be used for targeting external addresses.