简体   繁体   中英

Server.Transfer Method

When should I use Server.Transfer() method?

What is the advantage of using this method?

您可以使用Server.Transfer执行其他服务器端页面,而无需更改客户端上的地址,也无需执行Response.Redirect所做的其他重定向。

Server.Transfer allows you to redirect a request on the server-side to another resource on that server. This differs from Response.Redirect which redirects the client to another resource.

This means that processing of the requested resource is redirected to another existing resource. For example, you could have the request:

http://mydomain.com/users/100032

be handled by another resource on the server:

http://mydomain.com/users/100032/details

Server.Transfer will have the effect of both URLs returning the same response.

This differs from Response.Redirect , which has the effect of telling the client's browser "the resource you are requesting is at a different URL". In this case, the client's browser will make a new request to the URL and the client will see the URL change in their address bar to reflect this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM