的Response.Redirect和Server.Transfer的区别 [英] Difference between response.redirect and server.transfer
问题描述
可能显示的文件:结果
<一href=\"http://stackoverflow.com/questions/521527/response-redirect-vs-server-transfer\">Response.Redirect与Server.Transfer的结果
<一href=\"http://stackoverflow.com/questions/224569/server-transfer-vs-response-redirect\">Server.Transfer与Response.Redirect的
是什么的Response.Redirect和Server.Transfer的区别?
只有一个区别,我知道的是:在Response.Redirect的浏览器的URL变化有针对性的一页,也为在Server.Transfer的网址保持不变!
任何其他区别吗?
What is the difference between response.redirect and server.transfer? Only one difference i know is: In response.redirect the browser url changes to targeted page as well as in server.transfer the url remains same! any other difference?
推荐答案
的Response.Redirect时,应使用:
-
我们想请求重定向到一些普通的HTML页面我们
服务器或其他Web服务器
we want to redirect the request to some plain HTML pages on our server or to some other web server
我们不关心造成额外的往返到服务器上
每个请求
we don't care about causing additional roundtrips to the server on each request
我们不需要preserve查询字符串,并从表格变量
原始请求
we do not need to preserve Query String and Form Variables from the original request
我们希望我们的用户能够看到新的重定向的URL,在那里他
在他的浏览器重定向(并且能够仿佛加入书签,其
必要的话)
we want our users to be able to see the new redirected URL where he is redirected in his browser (and be able to bookmark it if its necessary)
的Server.Transfer时,应使用:
-
我们希望当前页请求转移到另一个.aspx页在同一台服务器上
we want to transfer current page request to another .aspx page on the same server
我们希望preserve服务器资源,避免不必要的
往返到服务器
we want to preserve server resources and avoid the unnecessary roundtrips to the server
我们希望preserve查询字符串和表单变量(可选)
we want to preserve Query String and Form Variables (optionally)
我们并不需要表现出我们在重定向请求的真正网址
用户的Web浏览器
we don't need to show the real URL where we redirected the request in the users Web Browser
这篇关于的Response.Redirect和Server.Transfer的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!