页面重定向Redirect和Transfer的区别
来源:互联网 发布:家用天文望远镜 知乎 编辑:程序博客网 时间:2024/05/18 03:22
- - - - - - - - - - - - - - - - - - - - - - - - - -
<% Server.Transfer "1.htm" %> <p>this is 1.htm</p>
<% Response.Redirect "1.htm" %>
请求:头部
GET /1.asp HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: localhost:8080
Connection: Keep-Alive
Cookie: ASPSESSIONIDACCTRTTT=PKKDJOPBAKMAMBNANIPIFDAP
@Server.Transfer应答: //直接在服务端执行1.htm并返回结果.对客户端而言是透明的.
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 12:52:44 GMT
X-Powered-By: ASP.NET
Content-Length: 20
Content-Type: text/html
Cache-control: private
<p>this is 1.htm</p>
@Response.Redirect应答: //通知客户端做重定向.
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 12:55:57 GMT
X-Powered-By: ASP.NET
Location: 1.htm
Content-Length: 121
Content-Type: text/html
Cache-control: private
<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="">here</a>.</body>
客户端收到Http302后,根据Location提供的文件地址.重新请求:
GET /1.htm HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: localhost:8080
Connection: Keep-Alive
If-Modified-Since: Thu, 06 Mar 2008 06:50:13 GMT
If-None-Match: "b224758ec53dc61:9f0"
Cookie: ASPSESSIONIDACCTRTTT=PKKDJOPBAKMAMBNANIPIFDAP
第二次应答:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
X-Powered-By: ASP.NET
Date: Sat, 31 May 2008 12:55:57 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Sat, 31 May 2008 12:52:32 GMT
ETag: "76d85bd51c41c61:9f0"
Content-Length: 20
<p>this is 1.htm</p>
附: 其它常见Http Response Head:
HTTP/1.1 401 Access Denied
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 09:15:55 GMT
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Connection: close
Content-Length: 3964
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html dir=ltr>
……
HTTP/1.1 403 Access Forbidden
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 08:57:39 GMT
Connection: close
Content-Type: text/html
Content-Length: 172
<html><head><title>Directory Listing Denied</title></head>
<body>...</body></html>
HTTP/1.1 404 Not Found
Date: Sat, 31 May 2008 09:03:14 GMT
Server: Apache/2.0.55 (Unix) PHP/5.0.5
Content-Length: 291
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head>
<body>...</body>
</html>
- 页面重定向Redirect和Transfer的区别
- 也说页面重定向 (Redirect和Transfer)
- 跳转(Forward)和页面重定向(Redirect)的区别
- 跳转(Forward)和页面重定向(Redirect)的区别
- 页面的转发(dispatcher)与重定向(redirect)的区别
- 页面跳转 Server.Transfer和 Response.Redirect的区别
- java web工程中关于redirect重定向和forward页面转发的区别
- forward转发 和 和 redirect重定向 的区别
- 转发(forward)和重定向(redirect)的区别
- forward内部跳转 和redirect重定向跳转的区别
- struts result type redirect 重定向和转发的区别
- forward内部跳转 和redirect重定向跳转的区别
- forward内部跳转 和redirect重定向跳转的区别
- forward(转发)和redirect(重定向)的区别
- forward(转发)和redirect(重定向)的区别
- forward内部跳转 和redirect重定向跳转的区别
- forward(转发)和redirect(重定向)的区别
- Forward(转发)和Redirect(重定向)的区别
- ALV 输出抬头
- 你可以为这世界付出更多
- 我的Java旅行01
- 计算机英语词汇:数据库
- Script.lua__padPress
- 页面重定向Redirect和Transfer的区别
- 李彦宏给创业者的七大建议
- How to extract the file *.tar.bz2?
- Visual Studio 2008下载地址,注册码及注册方法
- MySQL错误_中文参照列表
- 如何搭建WinCE开发环境
- Java:接口回调与向上转型
- 儿童节里的记忆
- Netbeans: optional language package is not installed