比较相似术语之间的差异

之间的区别

首页 / 技术 / 它 / 互联网 /服务器之间的区别。转移和响应。重定向

服务器之间的区别。转移和响应。重定向

2011年5月16日发布的Indika

服务器。转移和响应。重定向

Server和Response都是ASP.NET中的对象。Server对象为与服务器相关的各种任务提供方法和属性。Transfer是Server对象的一个方法,它将当前状态的信息发送到另一个.asp文件进行处理。响应对象描述与服务器响应相关的方法和属性。Redirect是Response对象的一个方法,它向浏览器发送一条消息,使浏览器连接到不同的URL。尽管服务器。转移和响应。重定向can be used to transfer a user from one page to another, they are different in how they actually perform this task.

Response.Redirect是什么?

Redirect是Response对象中的一个方法。当Response方法被调用时,它将向用户的浏览器发送HTTP代码302和所请求网页的URL。HTTP代码302通知用户的浏览器所请求的资源位于不同的URL下。当浏览器接收到代码时,它在新位置打开资源。被请求的网页可以驻留在与包含请求的页面相同的服务器上,也可以驻留在其他服务器上。当请求与当前页面位于同一服务器上的网页时,Response方法可以使用如下:

Response.Redirect(“nextPage.html”);

当请求驻留在另一台服务器上的网页时,Response方法可以使用如下:

Response.Redirect(“http://www.newServer.com/newPage.aspx”);

Server.Transfer是什么?

如前所述,Transfer是服务器对象的一个方法。当调用Transfer方法时,原始请求将被修改为传输到同一服务器中的其他页面。当使用服务器请求新页面时。转移,URL shown in the users’ web browser does not change. This is because the transfer happens in the server side and the browser does not have any knowledge about the transfer. By using the second overload for Server.Transfer(string path, bool preserveForm) and setting the second parameter as true, posted form variables and query strings can be made available to the second page.

服务器之间有什么区别。转让和Response.Redirect吗?

尽管服务器。转移和响应。重定向can be used to transfer a user from one page to another, there are some differences between the two methods. Besides the apparent syntactical difference, Response.Redirect makes a roundtrip to the server, while Server.Transfer changes the focus of the web server to a different web page. Therefore, by using Server.Transfer, server resources can be preserved. On the other hand Response.Redirect could be used to redirect the user to a web page in another server whereas Server.Transfer can only be used to redirect the user to web pages on the same server. Also by using Server.Transfer, properties of the previous page can be accessed by the new page but this is not possible with Response.Redirect. Additionally, Response.Redirect changes the URL in the address bar of the browser when the new page is accessed but when using the Server.Transfer the original URL is retained and the content of the page is just replaced. So the user cannot use it to bookmark the new page.

相关文章:

域名。com和。net的区别 GMT和UTC的差值GMT和UTC的差值 HTML 4和HTML 5的区别 DNS与DDNS的区别 反向查找区与正向查找区的区别

了下:互联网标记:ASP。网,HTTP代码302,重定向,响应,响应。重定向,服务器,服务器对象,服务器。转移,转移

关于作者:Indika

Indika,二元同步通信。工程硕士,计算机工程硕士,博士。计算机科学助理教授,在生物信息学、计算生物学和生物医学自然语言处理领域有研究兴趣。

留下一个回复取消回复

您的电邮地址将不会公布。必填项已标记*

请求的文章

特色的帖子

冠状病毒和感冒症状的区别

冠状病毒和感冒症状的区别

冠状病毒与SARS的区别

冠状病毒与SARS的区别

冠状病毒和流感的区别

冠状病毒和流感的区别

冠状病毒和Covid - 19的区别

冠状病毒和Covid - 19的区别

你可能会喜欢

摩托罗拉Atrix 4G和三星Galaxy S2 (Galaxy S II)的区别

侏儒和侏儒的区别

生物测定法与化学测定法的区别

生物测定法与化学测定法的区别

句子与话语的区别

句子与话语的区别

昆丹与波尔基的区别

最新的文章

  • 悬浮液和乳化液的区别是什么
  • 便秘和腹泻有什么区别
  • 土壤质地和土壤结构的区别是什么
  • 阑尾炎和克罗恩病的区别是什么
  • 真空泵和压缩机的区别是什么
  • 土和粘土的区别是什么
  • 首页
  • 职位空缺
  • 关于
  • 请求的文章
  • 联系我们

版权©2010 - 2018之间的区别.保留所有权利。使用条款和隐私政策:法律.