哪一个是更好的Server.Transfer和Response.Redirect的 [英] Which one is better Server.Transfer and Response.Redirect
问题描述
哪一个更好, Server.Transfer的
或的Response.Redirect
?我要寻找一些解释这一点。
Which one is better, Server.Transfer
or Response.Redirect
? I am looking for some explanation for this.
推荐答案
它们具有不同的功能。更好的定义取决于你正在尝试做的。
They have different functions. Definition of better depends on what you are trying to do.
的Response.Redirect告诉客户端访问一个新地址,其可以是任何地方。
Response.Redirect tells the client to visit a new address, which can be anywhere.
Server.Transfer的请求转发(可选preserving查询字符串)到另一页在同一台服务器上。
Server.Transfer forwards the request (optionally preserving the query string) to another page on the same server.
如果您的条件是削减不必要的开销,考虑到新的页面是一样的服务器上,Server.Transfer的是你想要的方式。
If your criterion is cutting unnecessary overhead given that the new page is on the same server, Server.Transfer is the method you want.
这篇关于哪一个是更好的Server.Transfer和Response.Redirect的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!