Server.Transfer is different from response.redirect

xiaoxiao2021-03-06  40

When MSDN looks at the documentation of the session, there is a Server.Transfer in the sample code. What is the difference between Server.Transfer and Response.Redirect? Go to Google to search, find a blog:

Server's Transfer and Response's Redirect

About Server.Transfer is different from response.redirect, extracted as follows:

//

TRANSFER: Reliable programmable target page should be another web form page in the same application (.aspx page). You cannot use the Server.Transfer to redirect to .asp or .asmx pages.

Make sure the target page exists.

Because Server.Transfer is executed on the server, so the browser does not have a record of page changes. Therefore, if the user refreshes this page, an unexpected result may occur.

//

Redirect: Reliable programming Redirect method is performed through the browser, so an additional round-trip process is generated between the server and the browser.

Make sure the target page exists.

Safety Since the method is performed through the client, it is easy to be deceived and tampered with.

//

Response is a browser to re-turning to the specified web page, while Server is naturally the server side, so there will be the following difference:

1. Server.Transfer can only be jumped to the page specified by the local virtual directory, and response.redirect is very flexible; 2. Server.transfer can pass the page parameters to the specified page; 3. When using, Server.Transfer jumps to After another page, the address displayed by the browser will not change, sometimes cause a misunderstanding, and of course some occasions need to be effect; 4. Server.transfer can reduce the client's request for the server;

转载请注明原文地址:https://www.9cbs.com/read-76477.html

New Post(0)